| 1 |
// { dg-do compile } |
| 2 |
|
| 3 |
// Crash tests from PR middle-end/6994. See also gcc.dg/vla-2.c. |
| 4 |
// A::A is acceptable extended C++ (VLA types brought over from C99); |
| 5 |
// B::B is not, but is closely related to acceptable extended C, though |
| 6 |
// not to acceptable C99. |
| 7 |
|
| 8 |
class A { A (int); }; |
| 9 |
|
| 10 |
A::A (int i) |
| 11 |
{ |
| 12 |
int ar[1][i]; // { dg-error "7:ISO C\\+\\+ forbids variable length array .ar" } |
| 13 |
|
| 14 |
ar[0][0] = 0; |
| 15 |
} |
| 16 |
|
| 17 |
class B { B (int); }; |
| 18 |
|
| 19 |
B::B (int i) |
| 20 |
{ |
| 21 |
struct S { |
| 22 |
int ar[1][i]; // { dg-error "15:size of array .ar. is not an integral" } |
| 23 |
} s; |
| 24 |
|
| 25 |
s.ar[0][0] = 0; // { dg-prune-output "no member" } |
| 26 |
} |