Merged revisions 208012,208018-208019,208021,208023-208030,208033,208037,208040-20804...
[official-gcc.git] / main / gcc / testsuite / g++.dg / cpp1y / vla9.C
blob5f49d11e9137eeb9ab79dcba401f0bdcae35e89f
1 // PR c++/57408
2 // { dg-do compile { target c++1y } }
4 template<typename Callable>
5   struct Impl
6   {
7     Callable func;
8     Impl(Callable f) : func(f) { }
9     virtual void run() { func(); }
10   };
12 template<typename Callable>
13 void call(Callable f)
14   {
15     Impl<Callable>(f).run();
16   }
18 extern "C" int printf(const char*, ...);
20 int main(){
21     int y = 2;
22     float fa[2][y];         // { dg-error "array of array of runtime bound" }
23     fa[0][0]=0.8;
24     fa[0][1]=1.8;
25     auto fx=[&](){
26         for(int c=0; c<2; c++){
27             printf("use me", fa[0][c]); // { dg-error "capture of variable-size type" }
28         }
29     };
30     call(fx);