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 default constructor}}
20 #endif
21   };
22   static struct {
23   };
24   class {
25     int anon_priv_field; // expected-error {{anonymous struct cannot contain a private data member}}
26   };
27 };
28 
29 template <class T> void foo(T);
30 typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}}
31 #if __cplusplus <= 199711L
32 // expected-note@-2 {{declared here}}
33 #endif
34 
test__anon6ec6c4b4050835   void test() {
36     foo(this);
37 #if __cplusplus <= 199711L
38     // expected-warning@-2 {{template argument uses unnamed type}}
39 #endif
40   }
41 } A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}
42