// PR c++/38577 // { dg-do compile } struct A { static A *bar (); }; struct B : public A { static void baz (); }; template void foo () { (static_cast (A::bar ()))->baz (); } void bar () { foo (); }