[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / ext / flexary27.C
blob9dfa9a2b82c9481176bb9eeffe7f9021fec89695
1 // PR c++/81922
2 // { dg-do compile }
4 struct S { const char *a; char b[]; };  // { dg-error "forbids flexible array member" }
5 struct T { int a; int b[]; };   // { dg-error "forbids flexible array member" }
6 #if __cplusplus >= 201103L
7 S c[] { "", "" };               // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
8                                 // { dg-error "initialization of a flexible array member" "" { target c++11 } .-1 }
9 S d[] { "", { 0 } };            // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
10                                 // { dg-error "initialization of a flexible array member" "" { target c++11 } .-1 }
11 T e[] { 1, { 2 }, 3, { 4 } };   // { dg-error "initialization of flexible array member in a nested context" "" { target c++11 } }
12                                 // { dg-error "initialization of a flexible array member" "" { target c++11 } .-1 }
13 T f[] { 1, {}, 3, {} };         // { dg-error "initialization of a flexible array member" "" { target c++11 } }
14 T g { 1, { 1, 2, 3 } };         // { dg-error "initialization of a flexible array member" "" { target c++11 } }
15 S h { "abcd", "" };             // { dg-error "initialization of a flexible array member" "" { target c++11 } }
16 #endif
17 S i[] = { "", "", "", "" };     // { dg-error "initialization of flexible array member in a nested context" }
18                                 // { dg-error "initialization of a flexible array member" "" { target *-*-* } .-1 }
19 S j[] = { "", { 1 }, "", { 2, 3 } };    // { dg-error "initialization of flexible array member in a nested context" }
20                                 // { dg-error "initialization of a flexible array member" "" { target *-*-* } .-1 }
21 T k[] = { 1, { 2 }, 3, { 4 } }; // { dg-error "initialization of flexible array member in a nested context" }
22                                 // { dg-error "initialization of a flexible array member" "" { target *-*-* } .-1 }
23 T l[] = { 1, {}, 3, {} };       // { dg-error "initialization of a flexible array member" }
24 T m = { 1, { 1, 2, 3 } };       // { dg-error "initialization of a flexible array member" }
25 S n = { "", "abcde" };          // { dg-error "initialization of a flexible array member" }