From a3379186762d6348e45bc5df34dfdea3e26bff98 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 3 Apr 2019 00:48:45 -0400 Subject: [PATCH] PR c++/89917 - ICE with lambda in variadic mem-init. 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 | 5 +++++ gcc/cp/pt.c | 2 +- .../g++.dg/cpp0x/lambda/lambda-variadic8.C | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic8.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 38f3e92a0ef..bb719133a97 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-04-03 Jason Merrill + + 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 PR c++/86946 - ICE with function call in template argument. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c72004a74e3..2b92b608f5d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3933,7 +3933,7 @@ make_pack_expansion (tree arg, tsubst_flags_t complain) class expansion. */ ppd.visited = new hash_set; ppd.parameter_packs = ¶meter_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 index 00000000000..50473f70214 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-variadic8.C @@ -0,0 +1,14 @@ +// PR c++/89917 +// { dg-do compile { target c++11 } } + +struct A +{ + A(...); +}; + +template struct B : T... +{ + B() : T([]{})... {} +}; + +B b; -- 2.30.2