http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56749
Bug #: 56749 Summary: weird interaction between scoped enum used as non-type template parameter and template lookup Classification: Unclassified Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: abiga...@gmail.com Hi, g++-4.81 built from svn r197010 on x86_64-apple-darwin12.3.0 with clang3.2. I find the following unexpected: enum normal_enum { not_scoped1, not_scoped2 }; enum class scoped_enum { scoped1, scoped2 }; template <normal_enum N=not_scoped1> class A { public: template <typename T> void fun () { } }; template <scoped_enum N=scoped_enum::scoped1> class B { public: template <typename T> void fun () { } }; template <typename T> void tfun () { A<> a; a.fun<char>(); <------------ THIS IS FINE B<> b_defaulted; B<scoped_enum::scoped1> b_explicited; //b_defaulted.fun<char>(); <------------ UNEXPECTED: THIS FAILS b_defaulted.template fun<char>(); <------------ THIS IS FINE //b_explicited.fun<char>(); <------------ UNEXPECTED: THIS FAILS b_explicited.template fun<char>(); <------------ THIS IS FINE } int main(int argc, char const *argv[]) { tfun<int>(); return 0; } IOW, it seems like using a scoped enum as a non-type template for a class, induces a requirement for template disambiguation when invoking a member template which is not happpening using an normal enum. Note that neither gcc 4.7.2 nor clang have this behavior. I assume this is not expected, as I would say "fun" is never a dependent name in the snippet above as neither a, b_defaulted and b_eplicited are, regardless of using a scoped enum or a normal enum as the non-type template. Regards, Andrea Bigagli.