aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-03-12 10:40:45 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-03-12 10:40:45 -0400
commitd67b5d8d1db0b9dff3e123a8e2be31cd5634821a (patch)
tree85be434db4db91dc09f8a55b2a087436b4207102 /gcc
parenta7fea88ffbba4300a1ec0ab5f3bb03c9a45817f2 (diff)
downloadgcc-d67b5d8d1db0b9dff3e123a8e2be31cd5634821a.zip
gcc-d67b5d8d1db0b9dff3e123a8e2be31cd5634821a.tar.gz
gcc-d67b5d8d1db0b9dff3e123a8e2be31cd5634821a.tar.bz2
PR c++/84355 - ICE with deduction for member class template.
* pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into CLASS_PLACEHOLDER_TEMPLATE. From-SVN: r258451
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/pt.c3
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/class-deduction50.C22
3 files changed, 27 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 703f597..e2373b2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-03-12 Jason Merrill <jason@redhat.com>
+ PR c++/84355 - ICE with deduction for member class template.
+ * pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Always substitute into
+ CLASS_PLACEHOLDER_TEMPLATE.
+
PR c++/84802 - ICE capturing uninstantiated class.
* lambda.c (build_capture_proxy): Call complete_type.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a92b36a..4640ca0 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14125,8 +14125,7 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
= tsubst_constraint (constr, args, complain, in_decl);
else if (tree pl = CLASS_PLACEHOLDER_TEMPLATE (t))
{
- if (DECL_TEMPLATE_TEMPLATE_PARM_P (pl))
- pl = tsubst (pl, args, complain, in_decl);
+ pl = tsubst_copy (pl, args, complain, in_decl);
CLASS_PLACEHOLDER_TEMPLATE (r) = pl;
}
}
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction50.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction50.C
new file mode 100644
index 0000000..e8cdd8c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction50.C
@@ -0,0 +1,22 @@
+// PR c++/84355
+// { dg-additional-options -std=c++17 }
+
+template <class, class> struct same;
+template <class T> struct same<T,T> {};
+
+template<typename T> struct A
+{
+ template<class U> struct B
+ {
+ B(U);
+ };
+
+ A() {
+ B b(0);
+ same<decltype(b),B<int>>{};
+ }
+};
+
+struct C {};
+
+A<C> a;