http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57317
Bug ID: 57317 Summary: [4.8/4.9] Regression bogus and unsuppressable warning: 'YYY' has a base 'ZZZ' whose type uses the anonymous namespace 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 reference: b/9004062 Quite similar, but not identical to PR 56641. Test case: // --- cut --- # 1 "t.h" template < typename T > struct integral_c { static const T value = 0; }; struct is_reference:integral_c < bool > { }; template < class > struct is_function_ptr_helper { }; template < bool > struct is_function_chooser; template <> struct is_function_chooser <0 > { template < typename T > struct result_:is_function_ptr_helper < T * > { }; }; template < typename T > struct is_function_impl:is_function_chooser < is_reference::value >::result_ < T > { }; #5 "t.cc" namespace { class NonCloneable; void fn1 () { is_function_impl < NonCloneable > i; } } // --- cut --- Using current (r199023) trunk: g++ -c t.ii t.h: In instantiation of 'struct is_function_chooser<false>::result_<{anonymous}::NonCloneable>': t.h:13:32: required from 'struct is_function_impl<{anonymous}::NonCloneable>' t.cc:10:39: required from here t.h:10:34: warning: 'is_function_chooser<false>::result_<{anonymous}::NonCloneable>' has a base 'is_function_ptr_helper<{anonymous}::NonCloneable*>' whose type uses the anonymous namespace [enabled by default] Richard Smiths says: I think GCC is upset that a type defined outside of the main source file has a template argument that has internal linkage. In principle, that's a valuable diagnostic: it's trying to tell you that every time you include that header, you're going to get a different type, and you're likely to have an ODR diagnostic. However, in this case, it's a false positive, because this happened while instantiating a template from the main source file (with a type defined in the main source file, no less). In addition, this warning isn't suppressable via -Wno-... parameter.