Debian Codegraph @

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

raw
1 // { dg-do compile }
2
3 // Origin: Giovanni Bajo <[email protected]>
4
5 // PR c++/4403: Incorrect friend class chosen during instantiation.
6
7 template <typename T>
8 struct A
9 {
10 struct F;
11 };
12
13 template <typename T>
14 struct B : A<T>
15 {
16 friend struct F;
17 private:
18 int priv;
19 };
20
21 struct F
22 {
23 void func(void)
24 {
25 B<int> b;
26 b.priv = 0;
27 }
28 };