xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/anonymous-struct.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 struct S {
4   S();  // expected-note {{because type 'S' has a user-provided default constructor}}
5 };
6 
7 struct { // expected-error {{anonymous structs and classes must be class members}}
8 };
9 
10 struct E {
11   struct {
12     S x;  // expected-error {{anonymous struct member 'x' has a non-trivial constructor}}
13   };
14   static struct {
15   };
16 };
17 
18 template <class T> void foo(T);
19 typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}} expected-note {{declared here}}
test__anon6fed09f9040820   void test() {
21     foo(this); // expected-warning {{template argument uses unnamed type}}
22   }
23 } A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}
24