commit 1fa864d218992c8a1b9b1fd4fae2205d5572205b
Author: Jason Merrill <jason@redhat.com>
Date: Thu Feb 20 23:35:28 2014 -0500
PR c++/60251
* lambda.c (is_normal_capture_proxy): Handle VLA capture.
@@ -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)
new file mode 100644
@@ -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" }
+}