|
| 1 | +// RUN: %clang_cc1 -Wno-unused-value -verify %s |
| 2 | + |
| 3 | +namespace N0 { |
| 4 | + template<typename T> |
| 5 | + 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>'}} |
| 52 | + |
| 53 | + // FIXME: An overloaded unary 'operator*' is built for these |
| 54 | + // even though the operand is a pointer (to a dependent type). |
| 55 | + // 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>'}} |
| 69 | + } |
| 70 | + }; |
| 71 | +} // namespace N0 |
| 72 | + |
| 73 | +namespace N1 { |
| 74 | + struct A { |
| 75 | + template<int I> |
| 76 | + void f(); |
| 77 | + }; |
| 78 | + |
| 79 | + template<typename T> |
| 80 | + struct B { |
| 81 | + template<int I> |
| 82 | + void f(); |
| 83 | + |
| 84 | + A x; |
| 85 | + A g(); |
| 86 | + |
| 87 | + void not_instantiated(B *a, B &b) { |
| 88 | + f<0>(); |
| 89 | + this->f<0>(); |
| 90 | + a->f<0>(); |
| 91 | + // FIXME: This should not require 'template'! |
| 92 | + (*this).f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 93 | + b.f<0>(); |
| 94 | + |
| 95 | + x.f<0>(); |
| 96 | + this->x.f<0>(); |
| 97 | + a->x.f<0>(); |
| 98 | + // FIXME: This should not require 'template'! |
| 99 | + (*this).x.f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 100 | + b.x.f<0>(); |
| 101 | + |
| 102 | + // FIXME: None of these should require 'template'! |
| 103 | + g().f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 104 | + this->g().f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 105 | + a->g().f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 106 | + (*this).g().f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 107 | + b.g().f<0>(); // expected-error{{missing 'template' keyword prior to dependent template name 'f'}} |
| 108 | + } |
| 109 | + }; |
| 110 | +} // namespace N1 |
0 commit comments