public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/redhat/heads/gcc-8-branch)] c++: Fix CTAD with multiple-arg ctor template [93248].
@ 2020-09-17 16:51 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-17 16:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8df863b47098c743b880549d2457f9387054c05f
commit 8df863b47098c743b880549d2457f9387054c05f
Author: Jason Merrill <jason@redhat.com>
Date: Sat Mar 14 17:10:39 2020 -0400
c++: Fix CTAD with multiple-arg ctor template [93248].
When cp_unevaluated_operand is set, tsubst_decl thinks that if it sees a
PARM_DECL that isn't already in local_specializations, we're in a decltype
in a trailing return type or some such, and so we only want a substitution
for a single PARM_DECL. In this case, we want the whole chain, so make sure
cp_unevaluated_operand is cleared.
gcc/cp/ChangeLog
2020-03-14 Jason Merrill <jason@redhat.com>
PR c++/93248
* pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
substituting DECL_ARGUMENTS.
Diff:
---
gcc/cp/ChangeLog | 6 ++++++
gcc/cp/pt.c | 5 ++++-
gcc/testsuite/g++.dg/cpp1z/class-deduction71.C | 6 ++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a525d4f4f9e..27b36eb7642 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/93248
+ * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
+ substituting DECL_ARGUMENTS.
+
2020-03-04 Release Manager
* GCC 8.4.0 released.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 409e86166c1..a2274f34725 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -26520,10 +26520,13 @@ build_deduction_guide (tree ctor, tree outer_args, tsubst_flags_t complain)
complain, ctor);
if (fparms == error_mark_node)
ok = false;
- fargs = tsubst (fargs, tsubst_args, complain, ctor);
if (ci)
ci = tsubst_constraint_info (ci, tsubst_args, complain, ctor);
+ /* Parms are to have DECL_CHAIN tsubsted, which would be skipped if
+ cp_unevaluated_operand. */
+ temp_override<int> ev (cp_unevaluated_operand, 0);
+ fargs = tsubst (fargs, tsubst_args, complain, ctor);
current_template_parms = save_parms;
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C
new file mode 100644
index 00000000000..2fc71de8d95
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction71.C
@@ -0,0 +1,6 @@
+// PR c++/93248
+// { dg-do compile { target c++17 } }
+
+template <typename T> struct S
+{ template <typename V> S (T, V, long = 0); };
+using U = decltype(S{0, 4u});
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-17 16:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 16:51 [gcc(refs/vendors/redhat/heads/gcc-8-branch)] c++: Fix CTAD with multiple-arg ctor template [93248] Jakub Jelinek
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).