http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57401
Bug ID: 57401 Summary: 'Conflicting declaration' involving using declaration and dependent name Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: lucdanton at free dot fr Using 4.9.0 20130509 (experimental) [trunk revision 198734] with flags -std=c++11: $ cat main.cpp struct base { using base_type = base; using type = int; }; template<typename T> struct derived: T { using typename derived::base_type::type; // Uses of once dependent type, explicitly introduced // into scope by using declaration above -- no complaints type foo(type); // No complaints as well static type t; }; // Error: conflicting declaration template<typename T> typename derived<T>::type derived<T>::t = 0; int main() {} //------------------- $ g++-snapshot -std=c++11 main.cpp main.cpp:20:39: error: conflicting declaration 'typename derived<T>::type derived<T>::t' typename derived<T>::type derived<T>::t = 0; ^ main.cpp:15:17: error: 'derived<T>::t' has a previous declaration as 'typename derived<T>::base_type::type derived<T>::t' static type t; ^ main.cpp:20:39: error: declaration of 'typename derived<T>::base_type::type derived<T>::t' outside of class is not definition [-fpermissive] typename derived<T>::type derived<T>::t = 0; ^ I suspect the code is wrongly rejected, as demonstrated by the other uses of type as if it weren't a dependent type anymore. (Admittedly writing a definition of foo that matches the declaration can be troublesome, but I assume this is the same issue in another form.) If it is any indication, Clang accepts the code.