Skip to content

Commit

Permalink
PR c++/84429 - ICE capturing VLA.
Browse files Browse the repository at this point in the history
	* lambda.c (build_capture_proxy): Handle reference refs.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@257836 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
jason committed Feb 20, 2018
1 parent c15ebdc commit e86f32c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
5 changes: 5 additions & 0 deletions gcc/cp/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2018-02-19 Jason Merrill <jason@redhat.com>

PR c++/84429 - ICE capturing VLA.
* lambda.c (build_capture_proxy): Handle reference refs.

2018-02-19 Jakub Jelinek <jakub@redhat.com>

PR c++/84448
Expand Down
7 changes: 4 additions & 3 deletions gcc/cp/lambda.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions gcc/testsuite/g++.dg/cpp0x/lambda/lambda-vla1.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// PR c++/84429
// { dg-do compile { target c++11 } }
// { dg-options "" }

void foo(int i)
{
char x[i];
[&]{ [&]{ return x; }; };
}

0 comments on commit e86f32c

Please sign in to comment.