gcc/testsuite/g++.dg/template/typename16.C
raw| 1 | // PR37314 rejects-valid, from w.doeringer |
| 2 | template <typename T> |
| 3 | struct A { |
| 4 | typedef __PTRDIFF_TYPE__ difference_type; |
| 5 | struct B { |
| 6 | typedef typename A<T>::difference_type difference_type; |
| 7 | difference_type operator-(B const&) const; |
| 8 | T t; |
| 9 | }; |
| 10 | }; |
| 11 | // |
| 12 | |
| 13 | template <typename T> |
| 14 | typename A<T>::B::difference_type A<T>::B::operator-(B const&) const { |
| 15 | return -1; |
| 16 | } |
| 17 | |
| 18 | // |
| 19 | int main() { |
| 20 | A<int>::B i; |
| 21 | ++i.t; |
| 22 | return 0; |
| 23 | } |
| 24 | |
| 25 |