public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2378] c++: alias CTAD in unevaluated context [PR101233] Date: Fri, 16 Jul 2021 20:21:42 +0000 (GMT) [thread overview] Message-ID: <20210716202142.6E16239A8C04@sourceware.org> (raw) https://gcc.gnu.org/g:a8b3861496bffae8b813ea196c1c5b27f79fbe69 commit r12-2378-ga8b3861496bffae8b813ea196c1c5b27f79fbe69 Author: Patrick Palka <ppalka@redhat.com> 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<class T, class U> +struct A { A(T, U); }; + +template<class T, class U> +using B = A<U, T>; + +using type = decltype(B{0, 0});
reply other threads:[~2021-07-16 20:21 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210716202142.6E16239A8C04@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).