Debian Codegraph @

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

raw
1 // PR c++/58993
2 // { dg-do compile }
3
4 class base { void foo(); };
5
6 template <class T>
7 struct bar : public base {
8 void f1() {
9 &base::foo; // { dg-error "private" }
10 }
11
12 template <class>
13 void f2() {
14 &base::foo; // { dg-error "private" }
15 }
16
17 void f3();
18 };
19
20 template <class T>
21 void bar<T>::f3() {
22 (void) &base::foo; // { dg-error "private" }
23 }
24
25 int main() {
26 bar<int>().f1();
27 bar<int>().f2<int>();
28 bar<int>().f3();
29 }