101 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wno-gnu2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DNONE -Wno-gnu3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DNONE -Wno-gnu4 5// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu 6// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DALL -Wgnu 7// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DALL -Wgnu 8 9// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wno-gnu \10// RUN: -Wgnu-anonymous-struct -Wredeclared-class-member \11// RUN: -Wgnu-flexible-array-union-member -Wgnu-folding-constant \12// RUN: -Wgnu-empty-struct13// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DALL -Wno-gnu \14// RUN: -Wgnu-anonymous-struct -Wredeclared-class-member \15// RUN: -Wgnu-flexible-array-union-member -Wgnu-folding-constant \16// RUN: -Wgnu-empty-struct17// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DALL -Wno-gnu \18// RUN: -Wgnu-anonymous-struct -Wredeclared-class-member \19// RUN: -Wgnu-flexible-array-union-member -Wgnu-folding-constant \20// RUN: -Wgnu-empty-struct21 22// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \23// RUN: -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \24// RUN: -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \25// RUN: -Wno-gnu-empty-struct26// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -DNONE -Wgnu \27// RUN: -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \28// RUN: -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \29// RUN: -Wno-gnu-empty-struct30// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -DNONE -Wgnu \31// RUN: -Wno-gnu-anonymous-struct -Wno-redeclared-class-member \32// RUN: -Wno-gnu-flexible-array-union-member -Wno-gnu-folding-constant \33// RUN: -Wno-gnu-empty-struct34 35// Additional disabled tests:36// %clang_cc1 -fsyntax-only -verify %s -DANONYMOUSSTRUCT -Wno-gnu -Wgnu-anonymous-struct37// %clang_cc1 -fsyntax-only -verify %s -DREDECLAREDCLASSMEMBER -Wno-gnu -Wredeclared-class-member38// %clang_cc1 -fsyntax-only -verify %s -DFLEXIBLEARRAYUNIONMEMBER -Wno-gnu -Wgnu-flexible-array-union-member39// %clang_cc1 -fsyntax-only -verify %s -DFOLDINGCONSTANT -Wno-gnu -Wgnu-folding-constant40// %clang_cc1 -fsyntax-only -verify %s -DEMPTYSTRUCT -Wno-gnu -Wgnu-empty-struct41 42#if NONE43// expected-no-diagnostics44#endif45 46 47#if ALL || ANONYMOUSSTRUCT48// expected-warning@+5 {{anonymous structs are a GNU extension}}49#endif50 51struct as {52 int x;53 struct {54 int a;55 float b;56 };57};58 59 60#if ALL || REDECLAREDCLASSMEMBER61// expected-note@+6 {{previous declaration is here}}62// expected-warning@+6 {{class member cannot be redeclared}}63#endif64 65namespace rcm {66 class A {67 class X;68 class X;69 class X {};70 };71}72 73 74#if ALL || FLEXIBLEARRAYUNIONMEMBER75// expected-warning@+6 {{flexible array member 'c1' in a union is a GNU extension}}76#endif77 78struct faum {79 int l;80 union {81 int c1[];82 };83};84 85 86#if (ALL || FOLDINGCONSTANT) && (__cplusplus <= 199711L) // C++03 or earlier modes87// expected-warning@+4 {{in-class initializer for static data member is not a constant expression; folding it to a constant is a GNU extension}}88#endif89 90struct fic {91 static const int B = int(0.75 * 1000 * 1000);92};93 94 95#if ALL || EMPTYSTRUCT96// expected-warning@+3 {{flexible array member 'a' in otherwise empty struct is a GNU extension}}97#endif98 99struct ofam {int a[];};100 101