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