PR c++/89917 - ICE with lambda in variadic mem-init.
authorJason Merrill <jason@redhat.com>
Wed, 3 Apr 2019 04:48:45 +0000 (00:48 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 3 Apr 2019 04:48:45 +0000 (00:48 -0400)
A mem-initializer is not a type, and we don't want to turn autos within it
into packs.

* pt.c (make_pack_expansion): Change type_pack_expansion_p to false.

From-SVN: r270111

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic8.C [new file with mode: 0644]

index 38f3e92a0ef4e2732e634738c6b130e1f86c4d22..bb719133a9726bb1b57345c316422ecddcc4126e 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-03  Jason Merrill  <jason@redhat.com>
+
+       PR c++/89917 - ICE with lambda in variadic mem-init.
+       * pt.c (make_pack_expansion): Change type_pack_expansion_p to false.
+
 2019-04-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/86946 - ICE with function call in template argument.
index c72004a74e346add044646a04800e55e96a24b73..2b92b608f5d455284ab4f052008494232ba66c56 100644 (file)
@@ -3933,7 +3933,7 @@ make_pack_expansion (tree arg, tsubst_flags_t complain)
          class expansion.  */
       ppd.visited = new hash_set<tree>;
       ppd.parameter_packs = &parameter_packs;
-      ppd.type_pack_expansion_p = true;
+      ppd.type_pack_expansion_p = false;
       gcc_assert (TYPE_P (TREE_PURPOSE (arg)));
       cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r, 
                     &ppd, ppd.visited);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic8.C
new file mode 100644 (file)
index 0000000..50473f7
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/89917
+// { dg-do compile { target c++11 } }
+
+struct A 
+{
+  A(...);
+};
+
+template<typename... T> struct B : T...
+{
+  B() : T([]{})... {}
+};
+
+B<A> b;