gcc/testsuite/g++.dg/template/memfriend8.C
raw| 1 | // { dg-do compile } |
| 2 | |
| 3 | // Origin: Martin Sebor <[email protected]> |
| 4 | |
| 5 | // PR c++/5369: Member function of class template as friend |
| 6 | |
| 7 | template <class T> |
| 8 | struct S |
| 9 | { |
| 10 | int foo () { |
| 11 | return S<int>::bar (); |
| 12 | } |
| 13 | |
| 14 | private: |
| 15 | |
| 16 | template <class U> |
| 17 | friend int S<U>::foo (); |
| 18 | |
| 19 | static int bar () { return 0; } |
| 20 | }; |
| 21 | |
| 22 | int main () |
| 23 | { |
| 24 | S<char>().foo (); |
| 25 | } |