• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 struct 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 };
13   friend struct M;
14   struct X;  //expected-note{{forward declaration of 'S::X'}}
15   friend struct X;
16 };
17 
18 S::EnumT Evar = S::E; // ok
19 S::EnumT Evar2 = EnumT(); //expected-error{{use of undeclared identifier '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'}}
22 
23 
24 struct S2
25 {
26   static int v2; // expected-note{{previous declaration is here}}
27   static int v2; //expected-error{{duplicate member 'v2'}}
28 };
29 
30 struct S3
31 {
32   static int v3;
33   struct S4
34   {
35     static int v3;
36   };
37 };
38 
39 struct S4
40 {
41   static int v4;
42 };
43 
44 int S4::v4; //expected-note{{previous definition is here}}
45 int S4::v4; //expected-error{{redefinition of 'v4'}}
46 
47 struct S5
48 {
49   static int v5; //expected-note{{previous definition is here}}
v5S550   void v5() { } //expected-error{{redefinition of 'v5' as different kind of symbol}}
51 
v6S552   void v6() { } //expected-note{{previous definition is here}}
53   static int v6; //expected-error{{redefinition of 'v6' as different kind of symbol}}
54 
v7S555   void v7() { }
v7S556   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 
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;
74     };
75 
76     Inner<int> _foo;
77   };
78 
f()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