diff options
author | Jason Merrill <jason@redhat.com> | 2014-02-21 09:01:20 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2014-02-21 09:01:20 -0500 |
commit | e429bc3555e7c3cbbc3b03ee0dbf78b3b9a4c198 (patch) | |
tree | 5eded1f97a4167997c4c70f0ff78d124ba7611a3 | |
parent | a866509aeb4f15738fe362a113265c2fcfe943d5 (diff) | |
download | gcc-e429bc3555e7c3cbbc3b03ee0dbf78b3b9a4c198.zip gcc-e429bc3555e7c3cbbc3b03ee0dbf78b3b9a4c198.tar.gz gcc-e429bc3555e7c3cbbc3b03ee0dbf78b3b9a4c198.tar.bz2 |
re PR c++/60251 ([c++11] ICE capturing variable-length array)
PR c++/60251
* lambda.c (is_normal_capture_proxy): Handle VLA capture.
From-SVN: r207995
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/lambda.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/vla11.C | 8 |
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index be248e1..e175768 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2014-02-21 Jason Merrill <jason@redhat.com> + PR c++/60251 + * lambda.c (is_normal_capture_proxy): Handle VLA capture. + PR c++/60167 PR c++/60222 PR c++/58606 diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 8bb820d..ad993e9d 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -250,6 +250,10 @@ is_normal_capture_proxy (tree decl) /* It's not a capture proxy. */ return false; + if (variably_modified_type_p (TREE_TYPE (decl), NULL_TREE)) + /* VLA capture. */ + return true; + /* It is a capture proxy, is it a normal capture? */ tree val = DECL_VALUE_EXPR (decl); if (val == error_mark_node) diff --git a/gcc/testsuite/g++.dg/cpp1y/vla11.C b/gcc/testsuite/g++.dg/cpp1y/vla11.C new file mode 100644 index 0000000..c9cdade --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/vla11.C @@ -0,0 +1,8 @@ +// PR c++/60251 +// { dg-options "-std=c++1y -pedantic-errors" } + +void foo(int n) +{ + int x[n]; + [&x]() { decltype(x) y; }; // { dg-error "decltype of array of runtime bound" } +} |