Debian Codegraph @

gcc/testsuite/g++.dg/ext/flexary11.C

raw
1 // PR c++/69253 - [6 Regression] g++ ICE at -O0 on x86_64-linux-gnu
2 // in "cxx_incomplete_type_diagnostic"
3 // { dg-do compile }
4
5 struct A {
6 int n;
7 char a[]; // { dg-error "8:ISO C\\+\\+ forbids flexible array member" }
8 };
9
10 void f ()
11 {
12 // Compound literals and flexible array members are G++ extensions
13 // accepted for compatibility with C and GCC.
14
15 // The following use of a flexible array member in a compound literal
16 // is invalid in C and rejected by GCC in C mode and so it's also
17 // rejected in C++ mode.
18 (struct A){ 1, "" }; // { dg-error "forbids compound-literals|initialization of a flexible array member|invalid use of a flexible array member" }
19 }