1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wno-gnu 2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu 3*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wno-gnu \ 4*f4a2713aSLionel Sambuc // RUN: -Wgnu-anonymous-struct -Wredeclared-class-member \ 5*f4a2713aSLionel Sambuc // RUN: -Wgnu-flexible-array-union-member -Wgnu-folding-constant \ 6*f4a2713aSLionel Sambuc // RUN: -Wgnu-empty-struct 7*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \ 8*f4a2713aSLionel Sambuc // RUN: -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \ 9*f4a2713aSLionel Sambuc // RUN: -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \ 10*f4a2713aSLionel Sambuc // RUN: -Wno-gnu-empty-struct 11*f4a2713aSLionel Sambuc // Additional disabled tests: 12*f4a2713aSLionel Sambuc // %clang_cc1 -fsyntax-only -verify %s -DANONYMOUSSTRUCT -Wno-gnu -Wgnu-anonymous-struct 13*f4a2713aSLionel Sambuc // %clang_cc1 -fsyntax-only -verify %s -DREDECLAREDCLASSMEMBER -Wno-gnu -Wredeclared-class-member 14*f4a2713aSLionel Sambuc // %clang_cc1 -fsyntax-only -verify %s -DFLEXIBLEARRAYUNIONMEMBER -Wno-gnu -Wgnu-flexible-array-union-member 15*f4a2713aSLionel Sambuc // %clang_cc1 -fsyntax-only -verify %s -DFOLDINGCONSTANT -Wno-gnu -Wgnu-folding-constant 16*f4a2713aSLionel Sambuc // %clang_cc1 -fsyntax-only -verify %s -DEMPTYSTRUCT -Wno-gnu -Wgnu-empty-struct 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc #if NONE 19*f4a2713aSLionel Sambuc // expected-no-diagnostics 20*f4a2713aSLionel Sambuc #endif 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc 23*f4a2713aSLionel Sambuc #if ALL || ANONYMOUSSTRUCT 24*f4a2713aSLionel Sambuc // expected-warning@+5 {{anonymous structs are a GNU extension}} 25*f4a2713aSLionel Sambuc #endif 26*f4a2713aSLionel Sambuc 27*f4a2713aSLionel Sambuc struct as { 28*f4a2713aSLionel Sambuc int x; 29*f4a2713aSLionel Sambuc struct { 30*f4a2713aSLionel Sambuc int a; 31*f4a2713aSLionel Sambuc float b; 32*f4a2713aSLionel Sambuc }; 33*f4a2713aSLionel Sambuc }; 34*f4a2713aSLionel Sambuc 35*f4a2713aSLionel Sambuc 36*f4a2713aSLionel Sambuc #if ALL || REDECLAREDCLASSMEMBER 37*f4a2713aSLionel Sambuc // expected-note@+6 {{previous declaration is here}} 38*f4a2713aSLionel Sambuc // expected-warning@+6 {{class member cannot be redeclared}} 39*f4a2713aSLionel Sambuc #endif 40*f4a2713aSLionel Sambuc 41*f4a2713aSLionel Sambuc namespace rcm { 42*f4a2713aSLionel Sambuc class A { 43*f4a2713aSLionel Sambuc class X; 44*f4a2713aSLionel Sambuc class X; 45*f4a2713aSLionel Sambuc class X {}; 46*f4a2713aSLionel Sambuc }; 47*f4a2713aSLionel Sambuc } 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambuc 50*f4a2713aSLionel Sambuc #if ALL || FLEXIBLEARRAYUNIONMEMBER 51*f4a2713aSLionel Sambuc // expected-warning@+6 {{flexible array member 'c1' in a union is a GNU extension}} 52*f4a2713aSLionel Sambuc #endif 53*f4a2713aSLionel Sambuc 54*f4a2713aSLionel Sambuc struct faum { 55*f4a2713aSLionel Sambuc int l; 56*f4a2713aSLionel Sambuc union { 57*f4a2713aSLionel Sambuc int c1[]; 58*f4a2713aSLionel Sambuc }; 59*f4a2713aSLionel Sambuc }; 60*f4a2713aSLionel Sambuc 61*f4a2713aSLionel Sambuc 62*f4a2713aSLionel Sambuc #if ALL || FOLDINGCONSTANT 63*f4a2713aSLionel Sambuc // expected-warning@+4 {{in-class initializer for static data member is not a constant expression; folding it to a constant is a GNU extension}} 64*f4a2713aSLionel Sambuc #endif 65*f4a2713aSLionel Sambuc 66*f4a2713aSLionel Sambuc struct fic { 67*f4a2713aSLionel Sambuc static const int B = int(0.75 * 1000 * 1000); 68*f4a2713aSLionel Sambuc }; 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambuc 71*f4a2713aSLionel Sambuc #if ALL || EMPTYSTRUCT 72*f4a2713aSLionel Sambuc // expected-warning@+3 {{flexible array member 'a' in otherwise empty struct is a GNU extension}} 73*f4a2713aSLionel Sambuc #endif 74*f4a2713aSLionel Sambuc 75*f4a2713aSLionel Sambuc struct ofam {int a[];}; 76*f4a2713aSLionel Sambuc 77