https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63268
Bug ID: 63268 Summary: Ambiguous non-specialized static template scope is accepted Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dak at gnu dot org The following code template <class T> class Bass { T elt; public: static void bing () { } }; class Deriv : Bass<int> { void boing () { Bass::bing (); } }; compiles without warning. However, Bass::bing, calling a static member function of a templated class, is ambiguous. It should be Bass<int>:: or Bass<float>:: or whatever since being a static member and explicitly resolved it is no longer tied to the class hierarchy of Deriv and thus it should not matter that Bass<int> is a base class of Deriv. I was hit by this when our project did a crosscompilation with an older version of g++ (no idea about the exact version, but should be in the 4.4 range or so) and balked at code like this that went unnoticed by g++ 4.8. Specifying the template argument class explicitly placated both 4.8 and whatever the older compiler version was. I think that the older compiler version was correct rejecting this.