gcc/testsuite/g++.dg/template/memfriend18.C
raw| 1 | // PR c++/87571 |
| 2 | |
| 3 | template <class> struct A { |
| 4 | template <class> struct B { |
| 5 | template <class> friend class B; |
| 6 | protected: |
| 7 | int protected_member_; |
| 8 | public: |
| 9 | template <class T> int method(const B<T>& other) const { |
| 10 | return other.protected_member_; |
| 11 | } |
| 12 | }; |
| 13 | }; |
| 14 | |
| 15 | int main() { |
| 16 | A<int>::B<int> a; |
| 17 | A<int>::B<char> b; |
| 18 | a.method(b); |
| 19 | } |