From b7d8e7e5d37109021f1fcc69cd7780656b85b51a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 2 Feb 2018 11:42:46 -0500 Subject: [PATCH] PR c++/84181 - ICE with lambda parm in template argument. * tree.c (strip_typedefs_expr): Use cp_tree_operand_length. From-SVN: r257339 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/tree.c | 2 +- .../g++.dg/cpp1y/lambda-generic-targ1.C | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp1y/lambda-generic-targ1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 728597599c5..9c76f8e528e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-02-02 Jason Merrill + + PR c++/84181 - ICE with lambda parm in template argument. + * tree.c (strip_typedefs_expr): Use cp_tree_operand_length. + 2018-02-01 Jason Merrill PR c++/84160 - ICE with nested variadic capture. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index e87c59659a5..c212c80ecf8 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1773,7 +1773,7 @@ strip_typedefs_expr (tree t, bool *remove_attributes) gcc_assert (EXPR_P (t)); - n = TREE_OPERAND_LENGTH (t); + n = cp_tree_operand_length (t); ops = XALLOCAVEC (tree, n); type = TREE_TYPE (t); diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-targ1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-targ1.C new file mode 100644 index 00000000000..fa852492f61 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-targ1.C @@ -0,0 +1,16 @@ +// PR c++/84181 +// { dg-do compile { target c++14 } } + +template < int ... I > +struct A{}; + +template < typename T > +void f(){ + [](auto ... i){ + return A< decltype(i){} ... >{}; + }; +} + +int main(){ + f< int >(); +} -- 2.30.2