PR c++/85006 - -fconcepts ICE with A<auto...> return type
authorJason Merrill <jason@redhat.com>
Wed, 4 Apr 2018 19:19:34 +0000 (15:19 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 4 Apr 2018 19:19:34 +0000 (15:19 -0400)
* pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.

From-SVN: r259100

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/concepts/auto4.C [new file with mode: 0644]

index 12d0c10..04670a3 100644 (file)
@@ -1,5 +1,8 @@
 2018-04-04  Jason Merrill  <jason@redhat.com>
 
+       PR c++/85006 - -fconcepts ICE with A<auto...> return type
+       * pt.c (tsubst_pack_expansion): Allow unsubstituted auto pack.
+
        PR c++/85200 - ICE with constexpr if in generic lambda.
        * tree.c (cp_walk_subtrees): Walk into DECL_EXPR in templates.
 
index 80670a4..dbbc766 100644 (file)
@@ -11860,7 +11860,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
          /* We can't substitute for this parameter pack.  We use a flag as
             well as the missing_level counter because function parameter
             packs don't have a level.  */
-         gcc_assert (processing_template_decl);
+         gcc_assert (processing_template_decl || is_auto (parm_pack));
          unsubstituted_packs = true;
        }
     }
diff --git a/gcc/testsuite/g++.dg/concepts/auto4.C b/gcc/testsuite/g++.dg/concepts/auto4.C
new file mode 100644 (file)
index 0000000..e80341e
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/85006
+// { dg-additional-options "-std=c++17 -fconcepts" }
+
+template<typename... Ts> struct A {};
+
+template<typename... Us> A<auto...> foo() { return A{}; }
+
+void bar()
+{
+  foo();
+}