From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1888) id 6E16239A8C04; Fri, 16 Jul 2021 20:21:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6E16239A8C04 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Patrick Palka To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2378] c++: alias CTAD in unevaluated context [PR101233] X-Act-Checkin: gcc X-Git-Author: Patrick Palka X-Git-Refname: refs/heads/master X-Git-Oldrev: d04b0c75794545f1f7a942764285e21eaf2915a1 X-Git-Newrev: a8b3861496bffae8b813ea196c1c5b27f79fbe69 Message-Id: <20210716202142.6E16239A8C04@sourceware.org> Date: Fri, 16 Jul 2021 20:21:42 +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: Fri, 16 Jul 2021 20:21:42 -0000 https://gcc.gnu.org/g:a8b3861496bffae8b813ea196c1c5b27f79fbe69 commit r12-2378-ga8b3861496bffae8b813ea196c1c5b27f79fbe69 Author: Patrick Palka Date: Fri Jul 16 16:21:13 2021 -0400 c++: alias CTAD in unevaluated context [PR101233] This is the alias CTAD version of the CTAD bug PR93248, and the fix is the same: clear cp_unevaluated_operand so that the entire chain of DECL_ARGUMENTS gets substituted. PR c++/101233 gcc/cp/ChangeLog: * pt.c (alias_ctad_tweaks): Clear cp_unevaluated_operand for substituting DECL_ARGUMENTS. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/class-deduction-alias10.C: New test. Diff: --- gcc/cp/pt.c | 8 +++++++- gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c7bf7d412ca..94ca3bc633e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -29097,7 +29097,13 @@ alias_ctad_tweaks (tree tmpl, tree uguides) /* Substitute the deduced arguments plus the rewritten template parameters into f to get g. This covers the type, copyness, guideness, and explicit-specifier. */ - tree g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain); + tree g; + { + /* Parms are to have DECL_CHAIN tsubsted, which would be skipped + if cp_unevaluated_operand. */ + cp_evaluated ev; + g = tsubst_decl (DECL_TEMPLATE_RESULT (f), targs, complain); + } if (g == error_mark_node) continue; DECL_USE_TEMPLATE (g) = 0; diff --git a/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C new file mode 100644 index 00000000000..a473fff5dc7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/class-deduction-alias10.C @@ -0,0 +1,10 @@ +// PR c++/101233 +// { dg-do compile { target c++20 } } + +template +struct A { A(T, U); }; + +template +using B = A; + +using type = decltype(B{0, 0});