Clang Project

clang_source_code/test/CXX/class/class.union/class.union.anon/p1.cpp
1// RUN: %clang_cc1 -verify %s
2
3struct X {
4  int a; // expected-note {{previous}}
5  void b(); // expected-note {{previous}}
6  struct c; // expected-note {{previous}}
7  typedef int d; // expected-note {{previous}}
8
9  union {
10    int a; // expected-error {{member of anonymous union redeclares}}
11    int b; // expected-error {{member of anonymous union redeclares}}
12    int c; // expected-error {{member of anonymous union redeclares}}
13    int d; // expected-error {{member of anonymous union redeclares}}
14    int e; // expected-note {{previous}}
15    int f; // expected-note {{previous}}
16    int g; // expected-note {{previous}}
17    int h; // expected-note {{previous}}
18  };
19
20  int e; // expected-error {{duplicate member}}
21  void f(); // expected-error {{redefinition}}
22  struct g; // expected-error {{redefinition}}
23  typedef int h; // expected-error {{redefinition}}
24};
25