summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1y/vla9.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y/vla9.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/vla9.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/vla9.C b/gcc/testsuite/g++.dg/cpp1y/vla9.C
new file mode 100644
index 00000000000..ea5c4d8eedb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/vla9.C
@@ -0,0 +1,31 @@
+// PR c++/57408
+// { dg-options "-std=c++1y -pedantic-errors" }
+
+template<typename Callable>
+ struct Impl
+ {
+ Callable func;
+ Impl(Callable f) : func(f) { }
+ virtual void run() { func(); }
+ };
+
+template<typename Callable>
+void call(Callable f)
+ {
+ Impl<Callable>(f).run();
+ }
+
+extern "C" int printf(const char*, ...);
+
+int main(){
+ int y = 2;
+ float fa[2][y]; // { dg-error "array of array of runtime bound" }
+ fa[0][0]=0.8;
+ fa[0][1]=1.8;
+ auto fx=[&](){
+ for(int c=0; c<2; c++){
+ printf("use me", fa[0][c]); // { dg-error "capture of variable-size type" }
+ }
+ };
+ call(fx);
+}