Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / class / class.mem / p1.cpp
blob3bd1df99d1736ca0db984820de7c6ff436e44a60
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 struct S
5 static int v1; // expected-note{{previous declaration is here}}
6 int v1; //expected-error{{duplicate member 'v1'}}
7 int v; //expected-note 2{{previous definition is here}} \
8 // expected-note{{previous declaration is here}}
9 static int v; //expected-error{{redefinition of 'v' as different kind of symbol}}
10 int v; //expected-error{{duplicate member 'v'}}
11 static int v; //expected-error{{redefinition of 'v' as different kind of symbol}}
12 enum EnumT { E = 10 }; // expected-note {{declared here}}
13 friend struct M;
14 struct X; //expected-note{{forward declaration of 'S::X'}}
15 friend struct X;
18 S::EnumT Evar = S::E; // ok
19 S::EnumT Evar2 = EnumT(); //expected-error{{use of undeclared identifier 'EnumT'; did you mean 'S::EnumT'?}}
20 S::M m; //expected-error{{no type named 'M' in 'S'}}
21 S::X x; //expected-error{{variable has incomplete type 'S::X'}}
24 struct S2
26 static int v2; // expected-note{{previous declaration is here}}
27 static int v2; //expected-error{{duplicate member 'v2'}}
30 struct S3
32 static int v3;
33 struct S4
35 static int v3;
39 struct S4
41 static int v4;
44 int S4::v4; //expected-note{{previous definition is here}}
45 int S4::v4; //expected-error{{redefinition of 'v4'}}
47 struct S5
49 static int v5; //expected-note{{previous definition is here}}
50 void v5() { } //expected-error{{redefinition of 'v5' as different kind of symbol}}
52 void v6() { } //expected-note{{previous definition is here}}
53 static int v6; //expected-error{{redefinition of 'v6' as different kind of symbol}}
55 void v7() { }
56 void v7(int) { } //expected-note{{previous definition is here}}
57 static int v7; //expected-error{{redefinition of 'v7' as different kind of symbol}}
59 void v8();
60 int v8(int); //expected-note{{previous declaration is here}}
61 int v8; //expected-error{{duplicate member 'v8'}}
66 namespace PR8245 {
67 class X {
68 public:
69 template<class C>
70 class Inner {
71 public:
72 void foo(bool bar = true);
73 int bam;
76 Inner<int> _foo;
79 void f() {
80 X::Inner<int> c2i;
81 X::Inner<float> c2f;
82 c2i.foo();
83 c2f.foo();
86 class Y {
87 class Inner {
88 void foo(int = sizeof(Y));