1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 4 5 struct S { 6 S(); 7 #if __cplusplus <= 199711L 8 // expected-note@-2 {{because type 'S' has a user-provided default constructor}} 9 #endif 10 }; 11 12 struct { // expected-error {{anonymous structs and classes must be class members}} 13 }; 14 15 struct E { 16 struct { 17 S x; 18 #if __cplusplus <= 199711L 19 // expected-error@-2 {{anonymous struct member 'x' has a non-trivial constructor}} 20 #endif 21 }; 22 static struct { 23 }; 24 }; 25 26 template <class T> void foo(T); 27 typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}} 28 #if __cplusplus <= 199711L 29 // expected-note@-2 {{declared here}} 30 #endif 31 32 void test() { 33 foo(this); 34 #if __cplusplus <= 199711L 35 // expected-warning@-2 {{template argument uses unnamed type}} 36 #endif 37 } 38 } A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}} 39