gcc/testsuite/g++.dg/template/lookup12.C
raw| 1 | // PR c++/94799 - member template function lookup fails. |
| 2 | |
| 3 | template<typename T> struct B { |
| 4 | void foo (); |
| 5 | int i; |
| 6 | }; |
| 7 | |
| 8 | template<typename T> |
| 9 | struct D : public B<T> { }; |
| 10 | |
| 11 | template<typename T> |
| 12 | void fn (D<T> d) |
| 13 | { |
| 14 | d.template B<T>::foo (); |
| 15 | d.template B<T>::i = 42; |
| 16 | D<T>().template B<T>::foo (); |
| 17 | d.template D<T>::template B<T>::foo (); |
| 18 | d.template D<T>::template B<T>::i = 10; |
| 19 | } |
| 20 | |
| 21 | int |
| 22 | main () |
| 23 | { |
| 24 | D<int> d; |
| 25 | fn(d); |
| 26 | } |