/* PR c++/34059 */ /* { dg-do compile } */ struct A { template void foo(); }; struct B : A {}; struct C : A {}; class AA { template void foo(); /* { dg-error "is private" } */ }; struct BB : AA {}; class AAA { int get() const {} }; struct BBB { static BBB *foo(); private: int get() const {} /* { dg-error "is private" } */ }; template struct S { S(unsigned int = BBB::foo()->AAA::get()); /* { dg-error "is not a base of" } */ }; template struct SS { SS(unsigned int = BBB::foo()->get()); /* { dg-error "within this context" } */ }; void bar() { B().C::foo<0>(); /* { dg-error "is not a member of" } */ BB().AA::foo<0>(); /* { dg-error "within this context" } */ int i; i.C::foo<0>(); /* { dg-error "which is of non-class type" } */ S s; /* { dg-error "default argument" } */ SS ss; }