gcc/testsuite/g++.dg/template/lookup13.C
raw| 1 | // PR c++/94799 - member template function lookup fails. |
| 2 | |
| 3 | template <typename T> |
| 4 | struct A { |
| 5 | int a() { |
| 6 | return 42; |
| 7 | } |
| 8 | |
| 9 | template<typename> struct X { typedef int type; }; |
| 10 | }; |
| 11 | |
| 12 | template <typename T> |
| 13 | struct B { |
| 14 | int b(A<T> *p) { |
| 15 | int i = 0; |
| 16 | i += p->a(); |
| 17 | i += p->template A<T>::a(); |
| 18 | i += p->template A<T>::template A<T>::a(); |
| 19 | i += A<T>().template A<T>::a(); |
| 20 | return i; |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | int main() { |
| 25 | A<int> a; |
| 26 | B<int> b; |
| 27 | return b.b(&a); |
| 28 | } |