https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85570
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note typedef has a similar issue and you don't even need to have main or an use of test to show the issue: void func() {} }; template <typename T> struct C : public A { typedef A TheA; }; template <typename T> void test1() { C<T> b; b.TheA::func(); }