http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58930
Bug ID: 58930 Summary: [C++11] Bogus error: converting to ... from initializer list would use explicit constructor Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ppluzhnikov at google dot com Google ref: b/11448857 This is somewhat similar to PR54835. // --- struct SampleModule { explicit SampleModule (int); }; template < typename > struct BaseHandler { #ifndef BUG BaseHandler (); #endif SampleModule module_ { 0 }; }; BaseHandler<int> a; // --- Clang compiles either variant. Trunk GCC (g++ (GCC) 4.9.0 20131028 (experimental)): g++ -c -std=c++11 t.cc && echo ok && g++ -c -std=c++11 t.cc -DBUG ok t.cc: In constructor 'constexpr BaseHandler<int>::BaseHandler()': t.cc:7:8: error: converting to 'SampleModule' from initializer list would use explicit constructor 'SampleModule::SampleModule(int)' struct BaseHandler ^ t.cc: At global scope: t.cc:15:18: note: synthesized method 'constexpr BaseHandler<int>::BaseHandler()' first required here BaseHandler<int> a; ^ Making BaseHandler a non-template class also makes the problem go away.