/cp
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / vla9.C
blob2c5b3a5404e9665d630694a3f9080adcb362c581
1 // PR c++/57408
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wno-vla" }
5 template<typename Callable>
6   struct Impl
7   {
8     Callable func;
9     Impl(Callable f) : func(f) { }
10     virtual void run() { func(); }
11   };
13 template<typename Callable>
14 void call(Callable f)
15   {
16     Impl<Callable>(f).run();
17   }
19 extern "C" int printf(const char*, ...);
21 int main(){
22     int y = 2;
23     float fa[2][y];
24     fa[0][0]=0.8;
25     fa[0][1]=1.8;
26     auto fx=[&](){
27         for(int c=0; c<2; c++){
28             printf("use me", fa[0][c]); // { dg-prune-output "sorry" }
29         }
30     };
31     call(fx);