1 /* { dg-options "-ansi -pedantic -pedantic-errors" } */
2 /* In strict ISO C++ mode, we don't recognize the anonymous struct
3 extension or any Microsoft C extensions. */
8 struct A; /* forward decl of B::A. */
11 char testB[sizeof(B) == sizeof(A) ? 1 : -1];
14 struct D { char d; }; /* decl of C::D. */
17 char testC[sizeof(C) == sizeof(A) ? 1 : -1];
18 char testD[sizeof(C::D) == sizeof(A) ? 1 : -1];
22 struct { char z; }; /* { dg-error "prohibits anonymous structs" } */
26 typedef struct A typedef_A;
28 typedef_A; /* { dg-error "does not declare anything" } */
31 char testF[sizeof(struct F) == sizeof(struct A) ? 1 : -1];
33 /* __extension__ enables GNU C mode for the duration of the declaration. */
34 __extension__ struct G {
38 char testG[sizeof(G) == 2 * sizeof(A) ? 1 : -1];
41 __extension__ struct { char z; };
44 char testH[sizeof(H) == 2 * sizeof(A) ? 1 : -1];
46 /* Make sure __extension__ gets turned back off. */
48 struct { char z; }; /* { dg-error "prohibits anonymous structs" } */