1 /* PR c++/34059 */
2 /* { dg-do compile } */
3 
4 struct A
5 {
6   template<int> void foo();
7 };
8 struct B : A {};
9 struct C : A {};
10 
11 class AA
12 {
13   template<int> void foo(); /* { dg-message "private" } */
14 };
15 struct BB : AA {};
16 
17 class AAA {
get()18   int get() const { return 0; }
19 };
20 struct BBB {
21   static BBB *foo();
22 private:
getBBB23   int get() const { return 1; } /* { dg-message "private" } */
24 };
25 template<bool> struct S {
26   S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */
27 };
28 template<bool> struct SS {
29   SS(unsigned int = BBB::foo()->get()); /* { dg-error "within this context" } */
30 };
31 
bar()32 void bar()
33 {
34   B().C::foo<0>(); /* { dg-error "is not a member of" } */
35   BB().AA::foo<0>(); /* { dg-error "within this context" } */
36 
37   int i;
38   i.C::foo<0>(); /* { dg-error "which is of non-class type" } */
39 
40   S<false> s;
41   SS<false> ss;
42 }
43