gcc/testsuite/g++.old-deja/g++.pt/memtemp16.C
raw| 1 | // { dg-do link } |
| 2 | // GROUPS passed templates membertemplates |
| 3 | extern "C" int printf(const char*, ...); |
| 4 | |
| 5 | template <class U> |
| 6 | struct S { |
| 7 | template <class T> |
| 8 | void operator+(T); |
| 9 | }; |
| 10 | |
| 11 | template <class U> |
| 12 | template <class T> |
| 13 | void S<U>::operator+(T) |
| 14 | { |
| 15 | printf("Hello, world.\n"); |
| 16 | } |
| 17 | |
| 18 | |
| 19 | int main() |
| 20 | { |
| 21 | S<int> s; |
| 22 | s + 3; |
| 23 | s + s; |
| 24 | s.operator+("Hi"); |
| 25 | |
| 26 | S<S<int> > s2; |
| 27 | s2 + 3; |
| 28 | s2 + s; |
| 29 | s2.operator+("Hi"); |
| 30 | } |