92 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s 2 3struct S 4{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;16};17 18S::EnumT Evar = S::E; // ok19S::EnumT Evar2 = EnumT(); //expected-error{{use of undeclared identifier 'EnumT'; did you mean 'S::EnumT'?}}20S::M m; //expected-error{{no type named 'M' in 'S'}}21S::X x; //expected-error{{variable has incomplete type 'S::X'}}22 23 24struct S2 25{26 static int v2; // expected-note{{previous declaration is here}}27 static int v2; //expected-error{{duplicate member 'v2'}}28};29 30struct S331{32 static int v3;33 struct S434 {35 static int v3;36 };37};38 39struct S440{41 static int v4;42};43 44int S4::v4; //expected-note{{previous definition is here}}45int S4::v4; //expected-error{{redefinition of 'v4'}}46 47struct S548{49 static int v5; //expected-note{{previous definition is here}}50 void v5() { } //expected-error{{redefinition of 'v5' as different kind of symbol}}51 52 void v6() { } //expected-note{{previous definition is here}}53 static int v6; //expected-error{{redefinition of 'v6' as different kind of symbol}}54 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}}58 59 void v8();60 int v8(int); //expected-note{{previous declaration is here}}61 int v8; //expected-error{{duplicate member 'v8'}}62 63 64};65 66namespace PR8245 {67 class X {68 public:69 template<class C> 70 class Inner {71 public:72 void foo(bool bar = true);73 int bam;74 };75 76 Inner<int> _foo; 77 };78 79 void f() {80 X::Inner<int> c2i;81 X::Inner<float> c2f;82 c2i.foo();83 c2f.foo();84 }85 86 class Y {87 class Inner {88 void foo(int = sizeof(Y));89 };90 };91}92