|
1 | 1 | // RUN: %clang_cc1 -Wno-unused-value -verify %s
|
2 | 2 |
|
3 | 3 | namespace N0 {
|
4 |
| - template<typename T> |
5 | 4 | struct A {
|
6 |
| - int x; |
7 |
| - void f(); |
8 |
| - using X = int; |
9 |
| - |
10 |
| - void not_instantiated(A *a, A &b) { |
11 |
| - x; |
12 |
| - f(); |
13 |
| - new X; |
14 |
| - |
15 |
| - this->x; |
16 |
| - this->f(); |
17 |
| - this->A::x; |
18 |
| - this->A::f(); |
19 |
| - |
20 |
| - a->x; |
21 |
| - a->f(); |
22 |
| - a->A::x; |
23 |
| - a->A::f(); |
24 |
| - |
25 |
| - (*this).x; |
26 |
| - (*this).f(); |
27 |
| - (*this).A::x; |
28 |
| - (*this).A::f(); |
29 |
| - |
30 |
| - b.x; |
31 |
| - b.f(); |
32 |
| - b.A::x; |
33 |
| - b.A::f(); |
34 |
| - |
35 |
| - A::x; |
36 |
| - A::f(); |
37 |
| - new A::X; |
38 |
| - |
39 |
| - y; // expected-error{{use of undeclared identifier 'y'}} |
40 |
| - g(); // expected-error{{use of undeclared identifier 'g'}} |
41 |
| - new Y; // expected-error{{unknown type name 'Y'}} |
42 |
| - |
43 |
| - this->y; // expected-error{{no member named 'y' in 'A<T>'}} |
44 |
| - this->g(); // expected-error{{no member named 'g' in 'A<T>'}} |
45 |
| - this->A::y; // expected-error{{no member named 'y' in 'A<T>'}} |
46 |
| - this->A::g(); // expected-error{{no member named 'g' in 'A<T>'}} |
47 |
| - |
48 |
| - a->y; // expected-error{{no member named 'y' in 'A<T>'}} |
49 |
| - a->g(); // expected-error{{no member named 'g' in 'A<T>'}} |
50 |
| - a->A::y; // expected-error{{no member named 'y' in 'A<T>'}} |
51 |
| - a->A::g(); // expected-error{{no member named 'g' in 'A<T>'}} |
| 5 | + int x0; |
| 6 | + static int x1; |
| 7 | + int x2; |
| 8 | + static int x3; |
| 9 | + |
| 10 | + void f0(); |
| 11 | + static void f1(); |
| 12 | + void f2(); |
| 13 | + static void f3(); |
| 14 | + |
| 15 | + using M0 = int; |
| 16 | + using M1 = int; |
| 17 | + |
| 18 | + struct C0 { }; |
| 19 | + struct C1 { }; |
| 20 | + }; |
| 21 | + |
| 22 | + template<typename T> |
| 23 | + struct B : A { |
| 24 | + int x4; |
| 25 | + static int x5; |
| 26 | + |
| 27 | + using A::x2; |
| 28 | + using A::x3; |
| 29 | + |
| 30 | + void f4(); |
| 31 | + static void f5(); |
| 32 | + |
| 33 | + using A::f2; |
| 34 | + using A::f3; |
| 35 | + |
| 36 | + using M2 = int; |
| 37 | + |
| 38 | + using A::M1; |
| 39 | + |
| 40 | + struct C2 { }; |
| 41 | + |
| 42 | + using A::C1; |
| 43 | + |
| 44 | + void not_instantiated(B *a, B &b) { |
| 45 | + // All of the following should be found in the current instantiation. |
| 46 | + |
| 47 | + new M0; |
| 48 | + new B::M0; |
| 49 | + new A::M0; |
| 50 | + new B::A::M0; |
| 51 | + new C0; |
| 52 | + new B::C0; |
| 53 | + new A::C0; |
| 54 | + new B::A::C0; |
| 55 | + new M1; |
| 56 | + new B::M1; |
| 57 | + new A::M1; |
| 58 | + new B::A::M1; |
| 59 | + new C1; |
| 60 | + new B::C1; |
| 61 | + new A::C1; |
| 62 | + new B::A::C1; |
| 63 | + new M2; |
| 64 | + new B::M2; |
| 65 | + new C2; |
| 66 | + new B::C2; |
| 67 | + |
| 68 | + x0; |
| 69 | + B::x0; |
| 70 | + A::x0; |
| 71 | + B::A::x0; |
| 72 | + x1; |
| 73 | + B::x1; |
| 74 | + A::x1; |
| 75 | + B::A::x1; |
| 76 | + x2; |
| 77 | + B::x2; |
| 78 | + A::x2; |
| 79 | + B::A::x2; |
| 80 | + x3; |
| 81 | + B::x3; |
| 82 | + A::x3; |
| 83 | + B::A::x3; |
| 84 | + x4; |
| 85 | + B::x4; |
| 86 | + x5; |
| 87 | + B::x5; |
| 88 | + |
| 89 | + f0(); |
| 90 | + B::f0(); |
| 91 | + A::f0(); |
| 92 | + B::A::f0(); |
| 93 | + f1(); |
| 94 | + B::f1(); |
| 95 | + A::f1(); |
| 96 | + B::A::f1(); |
| 97 | + f2(); |
| 98 | + B::f2(); |
| 99 | + A::f2(); |
| 100 | + B::A::f2(); |
| 101 | + f3(); |
| 102 | + B::f3(); |
| 103 | + A::f3(); |
| 104 | + B::A::f3(); |
| 105 | + f4(); |
| 106 | + B::f4(); |
| 107 | + f5(); |
| 108 | + B::f5(); |
| 109 | + |
| 110 | + this->x0; |
| 111 | + this->B::x0; |
| 112 | + this->A::x0; |
| 113 | + this->B::A::x0; |
| 114 | + this->x1; |
| 115 | + this->B::x1; |
| 116 | + this->A::x1; |
| 117 | + this->B::A::x1; |
| 118 | + this->x2; |
| 119 | + this->B::x2; |
| 120 | + this->A::x2; |
| 121 | + this->B::A::x2; |
| 122 | + this->x3; |
| 123 | + this->B::x3; |
| 124 | + this->A::x3; |
| 125 | + this->B::A::x3; |
| 126 | + this->x4; |
| 127 | + this->B::x4; |
| 128 | + this->x5; |
| 129 | + this->B::x5; |
| 130 | + |
| 131 | + this->f0(); |
| 132 | + this->B::f0(); |
| 133 | + this->A::f0(); |
| 134 | + this->B::A::f0(); |
| 135 | + this->f1(); |
| 136 | + this->B::f1(); |
| 137 | + this->A::f1(); |
| 138 | + this->B::A::f1(); |
| 139 | + this->f2(); |
| 140 | + this->B::f2(); |
| 141 | + this->A::f2(); |
| 142 | + this->B::A::f2(); |
| 143 | + this->f3(); |
| 144 | + this->B::f3(); |
| 145 | + this->A::f3(); |
| 146 | + this->B::A::f3(); |
| 147 | + this->f4(); |
| 148 | + this->B::f4(); |
| 149 | + this->f5(); |
| 150 | + this->B::f5(); |
| 151 | + |
| 152 | + a->x0; |
| 153 | + a->B::x0; |
| 154 | + a->A::x0; |
| 155 | + a->B::A::x0; |
| 156 | + a->x1; |
| 157 | + a->B::x1; |
| 158 | + a->A::x1; |
| 159 | + a->B::A::x1; |
| 160 | + a->x2; |
| 161 | + a->B::x2; |
| 162 | + a->A::x2; |
| 163 | + a->B::A::x2; |
| 164 | + a->x3; |
| 165 | + a->B::x3; |
| 166 | + a->A::x3; |
| 167 | + a->B::A::x3; |
| 168 | + a->x4; |
| 169 | + a->B::x4; |
| 170 | + a->x5; |
| 171 | + a->B::x5; |
| 172 | + |
| 173 | + a->f0(); |
| 174 | + a->B::f0(); |
| 175 | + a->A::f0(); |
| 176 | + a->B::A::f0(); |
| 177 | + a->f1(); |
| 178 | + a->B::f1(); |
| 179 | + a->A::f1(); |
| 180 | + a->B::A::f1(); |
| 181 | + a->f2(); |
| 182 | + a->B::f2(); |
| 183 | + a->A::f2(); |
| 184 | + a->B::A::f2(); |
| 185 | + a->f3(); |
| 186 | + a->B::f3(); |
| 187 | + a->A::f3(); |
| 188 | + a->B::A::f3(); |
| 189 | + a->f4(); |
| 190 | + a->B::f4(); |
| 191 | + a->f5(); |
| 192 | + a->B::f5(); |
| 193 | + |
| 194 | + (*this).x0; |
| 195 | + (*this).B::x0; |
| 196 | + (*this).A::x0; |
| 197 | + (*this).B::A::x0; |
| 198 | + (*this).x1; |
| 199 | + (*this).B::x1; |
| 200 | + (*this).A::x1; |
| 201 | + (*this).B::A::x1; |
| 202 | + (*this).x2; |
| 203 | + (*this).B::x2; |
| 204 | + (*this).A::x2; |
| 205 | + (*this).B::A::x2; |
| 206 | + (*this).x3; |
| 207 | + (*this).B::x3; |
| 208 | + (*this).A::x3; |
| 209 | + (*this).B::A::x3; |
| 210 | + (*this).x4; |
| 211 | + (*this).B::x4; |
| 212 | + (*this).x5; |
| 213 | + (*this).B::x5; |
| 214 | + |
| 215 | + (*this).f0(); |
| 216 | + (*this).B::f0(); |
| 217 | + (*this).A::f0(); |
| 218 | + (*this).B::A::f0(); |
| 219 | + (*this).f1(); |
| 220 | + (*this).B::f1(); |
| 221 | + (*this).A::f1(); |
| 222 | + (*this).B::A::f1(); |
| 223 | + (*this).f2(); |
| 224 | + (*this).B::f2(); |
| 225 | + (*this).A::f2(); |
| 226 | + (*this).B::A::f2(); |
| 227 | + (*this).f3(); |
| 228 | + (*this).B::f3(); |
| 229 | + (*this).A::f3(); |
| 230 | + (*this).B::A::f3(); |
| 231 | + (*this).f4(); |
| 232 | + (*this).B::f4(); |
| 233 | + (*this).f5(); |
| 234 | + (*this).B::f5(); |
| 235 | + |
| 236 | + b.x0; |
| 237 | + b.B::x0; |
| 238 | + b.A::x0; |
| 239 | + b.B::A::x0; |
| 240 | + b.x1; |
| 241 | + b.B::x1; |
| 242 | + b.A::x1; |
| 243 | + b.B::A::x1; |
| 244 | + b.x2; |
| 245 | + b.B::x2; |
| 246 | + b.A::x2; |
| 247 | + b.B::A::x2; |
| 248 | + b.x3; |
| 249 | + b.B::x3; |
| 250 | + b.A::x3; |
| 251 | + b.B::A::x3; |
| 252 | + b.x4; |
| 253 | + b.B::x4; |
| 254 | + b.x5; |
| 255 | + b.B::x5; |
| 256 | + |
| 257 | + b.f0(); |
| 258 | + b.B::f0(); |
| 259 | + b.A::f0(); |
| 260 | + b.B::A::f0(); |
| 261 | + b.f1(); |
| 262 | + b.B::f1(); |
| 263 | + b.A::f1(); |
| 264 | + b.B::A::f1(); |
| 265 | + b.f2(); |
| 266 | + b.B::f2(); |
| 267 | + b.A::f2(); |
| 268 | + b.B::A::f2(); |
| 269 | + b.f3(); |
| 270 | + b.B::f3(); |
| 271 | + b.A::f3(); |
| 272 | + b.B::A::f3(); |
| 273 | + b.f4(); |
| 274 | + b.B::f4(); |
| 275 | + b.f5(); |
| 276 | + b.B::f5(); |
| 277 | + |
| 278 | + // None of the following should be found in the current instantiation. |
| 279 | + |
| 280 | + new M3; // expected-error{{unknown type name 'M3'}} |
| 281 | + new B::M3; // expected-error{{no type named 'M3' in 'B<T>'}} |
| 282 | + new A::M3; // expected-error{{no type named 'M3' in 'N0::A'}} |
| 283 | + new B::A::M3; // expected-error{{no type named 'M3' in 'N0::A'}} |
| 284 | + |
| 285 | + x6; // expected-error{{use of undeclared identifier 'x6'}} |
| 286 | + B::x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 287 | + A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 288 | + B::A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 289 | + f6(); // expected-error{{use of undeclared identifier 'f6'}} |
| 290 | + B::f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 291 | + A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 292 | + B::A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 293 | + |
| 294 | + this->x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 295 | + this->B::x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 296 | + this->A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 297 | + this->B::A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 298 | + this->f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 299 | + this->B::f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 300 | + this->A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 301 | + this->B::A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 302 | + |
| 303 | + a->x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 304 | + a->B::x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 305 | + a->A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 306 | + a->B::A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 307 | + a->f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 308 | + a->B::f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 309 | + a->A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 310 | + a->B::A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
52 | 311 |
|
53 | 312 | // FIXME: An overloaded unary 'operator*' is built for these
|
54 | 313 | // even though the operand is a pointer (to a dependent type).
|
55 | 314 | // Type::isOverloadableType should return false for such cases.
|
56 |
| - (*this).y; |
57 |
| - (*this).g(); |
58 |
| - (*this).A::y; |
59 |
| - (*this).A::g(); |
60 |
| - |
61 |
| - b.y; // expected-error{{no member named 'y' in 'A<T>'}} |
62 |
| - b.g(); // expected-error{{no member named 'g' in 'A<T>'}} |
63 |
| - b.A::y; // expected-error{{no member named 'y' in 'A<T>'}} |
64 |
| - b.A::g(); // expected-error{{no member named 'g' in 'A<T>'}} |
65 |
| - |
66 |
| - A::y; // expected-error{{no member named 'y' in 'A<T>'}} |
67 |
| - A::g(); // expected-error{{no member named 'g' in 'A<T>'}} |
68 |
| - new A::Y; // expected-error{{no type named 'Y' in 'A<T>'}} |
| 315 | + (*this).x6; |
| 316 | + (*this).B::x6; |
| 317 | + (*this).A::x6; |
| 318 | + (*this).B::A::x6; |
| 319 | + (*this).f6(); |
| 320 | + (*this).B::f6(); |
| 321 | + (*this).A::f6(); |
| 322 | + (*this).B::A::f6(); |
| 323 | + |
| 324 | + b.x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 325 | + b.B::x6; // expected-error{{no member named 'x6' in 'B<T>'}} |
| 326 | + b.A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 327 | + b.B::A::x6; // expected-error{{no member named 'x6' in 'N0::A'}} |
| 328 | + b.f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 329 | + b.B::f6(); // expected-error{{no member named 'f6' in 'B<T>'}} |
| 330 | + b.A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
| 331 | + b.B::A::f6(); // expected-error{{no member named 'f6' in 'N0::A'}} |
69 | 332 | }
|
70 | 333 | };
|
71 | 334 | } // namespace N0
|
|
0 commit comments