PR c++/84015 - ICE with class deduction and auto template parm.
authorJason Merrill <jason@redhat.com>
Mon, 26 Feb 2018 05:05:15 +0000 (00:05 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 26 Feb 2018 05:05:15 +0000 (00:05 -0500)
* pt.c (rewrite_template_parm): Use tf_partial in first tsubst.

From-SVN: r257979

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1z/class-deduction49.C [new file with mode: 0644]

index 3d4c946ad16a53dee16c67ac6b3a974b21273263..cb0dcd7c43ebe0e47ba03a4678d5d7b71abdb17b 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-25  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84015 - ICE with class deduction and auto template parm.
+       * pt.c (rewrite_template_parm): Use tf_partial in first tsubst.
+
 2018-02-24  Marek Polacek  <polacek@redhat.com>
 
        PR c++/83692
index 85d1adbbe3c3f495a97fe4bfaba496d5a1561765..9cf96e9fbe4bf0a34b3a79d5c5439f171f3bc0b5 100644 (file)
@@ -25596,7 +25596,7 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level,
          // Substitute ttargs into ttparms to fix references to
          // other template parameters.
          ttparms = tsubst_template_parms_level (ttparms, ttargs,
-                                                complain);
+                                                complain|tf_partial);
          // Now substitute again with args based on tparms, to reduce
          // the level of the ttparms.
          ttargs = current_template_args ();
diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction49.C
new file mode 100644 (file)
index 0000000..086f12a
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/84015
+// { dg-additional-options -std=c++17 }
+
+template <int I>
+struct A { };
+
+template <int I>
+struct B
+{
+  template<template<auto>class T>
+  B(T<I>);
+};
+
+A<42> a;
+B b (a);