Debian Codegraph @

gcc/testsuite/g++.dg/tc1/dr161.C

raw
1 // { dg-do compile }
2 // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR161: Access to protected nested type
4
5 namespace N1 {
6 struct A
7 {
8 protected:
9 typedef int type;
10 };
11
12 struct B : public A
13 {
14 void test(void)
15 {
16 A::type t;
17 }
18
19 friend void ftest(void)
20 {
21 A::type t;
22 }
23 };
24 }
25
26
27 namespace N2 {
28 template <class T>
29 struct A
30 {
31 protected:
32 typedef int type;
33 };
34
35 template <class T>
36 struct B : public A<T>
37 {
38 void test(B b)
39 {
40 typename A<T>::type t;
41 }
42
43 friend void ftest(B b)
44 {
45 typename A<T>::type t;
46 }
47 };
48
49 template struct B<void>;
50 }