http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55173
Bug #: 55173 Summary: GCC gives wrong location, and ignores -isystem, when warning about default arguments Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: mw_tr...@users.sourceforge.net This came up originally related to bug 52718, but according to Paolo there, is not actually related at all... Consider the following header: #pragma GCC system_header // or include via -isystem class Foo { Foo(void* = 0); }; class Bar { Bar(Foo = 0, void* = 0) }; The following instantiation: Bar bar; ...trips -Wzero-as-null-pointer-constant (also, the warning is reported in the source file, not the header). This appears to only happen when a default parameter implicitly invokes a constructor, where the warning occurs in the constructor invocation. IOW, this: Bar bar(nullptr); ...does not trigger a warning, as 'Foo(nullptr)' is okay. Besides the less-helpful-than-desired diagnostic, this behavior is unfortunate, as it prevents promoting warnings to errors in the face of such constructs, or else forcing programmers to avoid use of default parameters.