1 /* { dg-options "" } */ 2 /* In GNU C++ mode, we recognize the anonymous struct extension, 3 but not Microsoft C extensions. */ 4 5 struct A { char a; }; 6 7 struct B { 8 struct A; /* forward decl of B::A. */ 9 char b; 10 }; 11 char testB[sizeof(B) == sizeof(A) ? 1 : -1]; 12 13 struct C { 14 struct D { char d; }; /* decl of C::D. */ 15 char c; 16 }; 17 char testC[sizeof(C) == sizeof(A) ? 1 : -1]; 18 char testD[sizeof(C::D) == sizeof(A) ? 1 : -1]; 19 20 /* GNU extension. */ 21 struct E { 22 struct { char z; }; 23 char e; 24 }; 25 char testE[sizeof(E) == 2 * sizeof(A) ? 1 : -1]; 26 char testEz[sizeof( ((E *)0)->z )]; 27 28 typedef struct A typedef_A; 29 struct F { 30 typedef_A; /* { dg-error "does not declare anything" } */ 31 char f; 32 }; 33 char testF[sizeof(F) == sizeof(A) ? 1 : -1]; 34 35 /* Test that __extension__ does the right thing coming _from_ GNU C mode. */ 36 __extension__ struct G { 37 struct { char z; }; 38 char g; 39 }; 40 char testG[sizeof(G) == 2 * sizeof(A) ? 1 : -1]; 41 42 struct H { 43 struct { char z; }; 44 char h; 45 }; 46 char testH[sizeof(H) == 2 * sizeof(A) ? 1 : -1]; 47