From: Jason Merrill Date: Tue, 20 Feb 2018 03:39:37 +0000 (-0500) Subject: PR c++/84429 - ICE capturing VLA. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=329a89d34cedb0aec759f9c4531d2dbba7f0937b;p=gcc.git PR c++/84429 - ICE capturing VLA. * lambda.c (build_capture_proxy): Handle reference refs. From-SVN: r257836 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 870dde6388d..000e72f2286 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-02-19 Jason Merrill + + PR c++/84429 - ICE capturing VLA. + * lambda.c (build_capture_proxy): Handle reference refs. + 2018-02-19 Jakub Jelinek PR c++/84448 diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 38500b13262..a0a80dfde5c 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -451,11 +451,12 @@ build_capture_proxy (tree member, tree init) { if (PACK_EXPANSION_P (init)) init = PACK_EXPANSION_PATTERN (init); - if (INDIRECT_REF_P (init)) - init = TREE_OPERAND (init, 0); - STRIP_NOPS (init); } + if (INDIRECT_REF_P (init)) + init = TREE_OPERAND (init, 0); + STRIP_NOPS (init); + gcc_assert (VAR_P (init) || TREE_CODE (init) == PARM_DECL); while (is_normal_capture_proxy (init)) init = DECL_CAPTURED_VARIABLE (init); diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-vla1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-vla1.C new file mode 100644 index 00000000000..91498c4589a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-vla1.C @@ -0,0 +1,9 @@ +// PR c++/84429 +// { dg-do compile { target c++11 } } +// { dg-options "" } + +void foo(int i) +{ + char x[i]; + [&]{ [&]{ return x; }; }; +}