From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2100) id C1D8D387087B; Sat, 22 Aug 2020 23:29:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1D8D387087B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1598138950; bh=XRnkSSDbkkvHYCS7w3Ltf72HWdBeAtRSit7MADoC7d8=; h=From:To:Subject:Date:From; b=ESH20hhfPTGBMUoBut3um1kZM1V1uzrHcdO3uEiuNFxgx/ljkHaVESXZ4435AnH0P A/5FOFI9S/PhuG9Y24vwqMtA6S3IYvwT8RQaaueAUh4mieq01jmZqUFQCt0uCDZB5E /10iYyfcAd9fxuc/QlGpU9+UXpF1s+8pQe1vUxGY= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Giuliano Belinassi To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/autopar_devel] c++: Partially revert fix for PR c++/95497 [PR96132] X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/devel/autopar_devel X-Git-Oldrev: 7d54540883078fd9faabdab9d39df8f3e5714f69 X-Git-Newrev: 9872b77784d7d71f6d458ef11f0af6ad772a7dff Message-Id: <20200822232910.C1D8D387087B@sourceware.org> Date: Sat, 22 Aug 2020 23:29:10 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2020 23:29:10 -0000 https://gcc.gnu.org/g:9872b77784d7d71f6d458ef11f0af6ad772a7dff commit 9872b77784d7d71f6d458ef11f0af6ad772a7dff Author: Patrick Palka Date: Thu Jul 9 13:47:13 2020 -0400 c++: Partially revert fix for PR c++/95497 [PR96132] I was mistaken to assume that a dependent type is necessarily incomplete, and indeed there are multiple places in the frontend where we check a type for both dependency and completeness. So this patch partially reverts the fix for PR95497, restoring the dependent_type_p check that guarded the call to is_really_empty_class below. gcc/cp/ChangeLog: PR c++/96132 * constexpr.c (potential_constant_expression_1) : Restore dependent_type_p check that guarded the call to is_really_empty_class. gcc/testsuite/ChangeLog: PR c++/96132 * g++.dg/template/incomplete12.C: New test. Diff: --- gcc/cp/constexpr.c | 1 + gcc/testsuite/g++.dg/template/incomplete12.C | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index ff78ebda2dc..97dcc1b1d10 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -7444,6 +7444,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now, { tree type = TREE_TYPE (t); if ((processing_template_decl && !COMPLETE_TYPE_P (type)) + || dependent_type_p (type) || is_really_empty_class (type, /*ignore_vptr*/false)) /* An empty class has no data to read. */ return true; diff --git a/gcc/testsuite/g++.dg/template/incomplete12.C b/gcc/testsuite/g++.dg/template/incomplete12.C new file mode 100644 index 00000000000..335e5356874 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/incomplete12.C @@ -0,0 +1,9 @@ +// PR c++/96132 +// { dg-do compile } + +template class a; + +template class c { + a e; + void operator=(c d) { e = d; } +};