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