summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/class/class.union/class.union.anon/p1.cpp
blob: 31c9313cf53a96c7aa7386140d1605017d04f0fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %clang_cc1 -verify %s

struct X {
  int a; // expected-note {{previous}}
  void b(); // expected-note {{previous}}
  struct c; // expected-note {{previous}}
  typedef int d; // expected-note {{previous}}

  union {
    int a; // expected-error {{member of anonymous union redeclares}}
    int b; // expected-error {{member of anonymous union redeclares}}
    int c; // expected-error {{member of anonymous union redeclares}}
    int d; // expected-error {{member of anonymous union redeclares}}
    int e; // expected-note {{previous}}
    int f; // expected-note {{previous}}
    int g; // expected-note {{previous}}
    int h; // expected-note {{previous}}
  };

  int e; // expected-error {{duplicate member}}
  void f(); // expected-error {{redefinition}}
  struct g; // expected-error {{redefinition}}
  typedef int h; // expected-error {{redefinition}}
};
OpenPOWER on IntegriCloud