1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s 2*67e74705SXin Li 3*67e74705SXin Li struct S 4*67e74705SXin Li { 5*67e74705SXin Li static int v1; // expected-note{{previous declaration is here}} 6*67e74705SXin Li int v1; //expected-error{{duplicate member 'v1'}} 7*67e74705SXin Li int v; //expected-note 2{{previous definition is here}} \ 8*67e74705SXin Li // expected-note{{previous declaration is here}} 9*67e74705SXin Li static int v; //expected-error{{redefinition of 'v' as different kind of symbol}} 10*67e74705SXin Li int v; //expected-error{{duplicate member 'v'}} 11*67e74705SXin Li static int v; //expected-error{{redefinition of 'v' as different kind of symbol}} 12*67e74705SXin Li enum EnumT { E = 10 }; 13*67e74705SXin Li friend struct M; 14*67e74705SXin Li struct X; //expected-note{{forward declaration of 'S::X'}} 15*67e74705SXin Li friend struct X; 16*67e74705SXin Li }; 17*67e74705SXin Li 18*67e74705SXin Li S::EnumT Evar = S::E; // ok 19*67e74705SXin Li S::EnumT Evar2 = EnumT(); //expected-error{{use of undeclared identifier 'EnumT'}} 20*67e74705SXin Li S::M m; //expected-error{{no type named 'M' in 'S'}} 21*67e74705SXin Li S::X x; //expected-error{{variable has incomplete type 'S::X'}} 22*67e74705SXin Li 23*67e74705SXin Li 24*67e74705SXin Li struct S2 25*67e74705SXin Li { 26*67e74705SXin Li static int v2; // expected-note{{previous declaration is here}} 27*67e74705SXin Li static int v2; //expected-error{{duplicate member 'v2'}} 28*67e74705SXin Li }; 29*67e74705SXin Li 30*67e74705SXin Li struct S3 31*67e74705SXin Li { 32*67e74705SXin Li static int v3; 33*67e74705SXin Li struct S4 34*67e74705SXin Li { 35*67e74705SXin Li static int v3; 36*67e74705SXin Li }; 37*67e74705SXin Li }; 38*67e74705SXin Li 39*67e74705SXin Li struct S4 40*67e74705SXin Li { 41*67e74705SXin Li static int v4; 42*67e74705SXin Li }; 43*67e74705SXin Li 44*67e74705SXin Li int S4::v4; //expected-note{{previous definition is here}} 45*67e74705SXin Li int S4::v4; //expected-error{{redefinition of 'v4'}} 46*67e74705SXin Li 47*67e74705SXin Li struct S5 48*67e74705SXin Li { 49*67e74705SXin Li static int v5; //expected-note{{previous definition is here}} v5S550*67e74705SXin Li void v5() { } //expected-error{{redefinition of 'v5' as different kind of symbol}} 51*67e74705SXin Li v6S552*67e74705SXin Li void v6() { } //expected-note{{previous definition is here}} 53*67e74705SXin Li static int v6; //expected-error{{redefinition of 'v6' as different kind of symbol}} 54*67e74705SXin Li v7S555*67e74705SXin Li void v7() { } v7S556*67e74705SXin Li void v7(int) { } //expected-note{{previous definition is here}} 57*67e74705SXin Li static int v7; //expected-error{{redefinition of 'v7' as different kind of symbol}} 58*67e74705SXin Li 59*67e74705SXin Li void v8(); 60*67e74705SXin Li int v8(int); //expected-note{{previous declaration is here}} 61*67e74705SXin Li int v8; //expected-error{{duplicate member 'v8'}} 62*67e74705SXin Li 63*67e74705SXin Li 64*67e74705SXin Li }; 65*67e74705SXin Li 66*67e74705SXin Li namespace PR8245 { 67*67e74705SXin Li class X { 68*67e74705SXin Li public: 69*67e74705SXin Li template<class C> 70*67e74705SXin Li class Inner { 71*67e74705SXin Li public: 72*67e74705SXin Li void foo(bool bar = true); 73*67e74705SXin Li int bam; 74*67e74705SXin Li }; 75*67e74705SXin Li 76*67e74705SXin Li Inner<int> _foo; 77*67e74705SXin Li }; 78*67e74705SXin Li f()79*67e74705SXin Li void f() { 80*67e74705SXin Li X::Inner<int> c2i; 81*67e74705SXin Li X::Inner<float> c2f; 82*67e74705SXin Li c2i.foo(); 83*67e74705SXin Li c2f.foo(); 84*67e74705SXin Li } 85*67e74705SXin Li 86*67e74705SXin Li class Y { 87*67e74705SXin Li class Inner { 88*67e74705SXin Li void foo(int = sizeof(Y)); 89*67e74705SXin Li }; 90*67e74705SXin Li }; 91*67e74705SXin Li } 92