Debian Codegraph @

gcc/testsuite/g++.dg/template/memfriend16.C

raw
1 // { dg-do compile }
2
3 // Copyright (C) 2004 Free Software Foundation
4 // Contributed by Kriang Lerdsuwanakij <[email protected]>
5
6 // Nested class of class template as friend
7
8 template<class T> struct A
9 {
10 template <class U> struct B1
11 {
12 };
13 template <class U> struct B2
14 {
15 void f();
16 };
17 };
18
19 class C {
20 int i; // { dg-message "private" }
21 template<class T> template <class U> friend struct A<T>::B1;
22 };
23
24 template<class T> template <class U> void A<T>::B2<U>::f()
25 {
26 C c;
27 c.i = 0; // { dg-error "context" }
28 }
29
30 int main()
31 {
32 A<int>::B2<int> b1;
33 b1.f(); // { dg-message "required" }
34 }