http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52718
Bug #: 52718
Summary: -Wzero-as-null-pointer-constant: misleading location
for 0 as default argument
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 26990
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26990
0 instead of nullptr as default argument
I don't think this is a duplicated of 51196.
In the following example, the locations about the uses of 0
instead of nullptr are misleading: none point to the real
issue, but they point to where the default argument was used.
$ g++-mp-4.8 -Wzero-as-null-pointer-constant -c /tmp/foo.cc
/tmp/foo.cc: In constructor 'bar::bar()':
/tmp/foo.cc:10:9: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
/tmp/foo.cc: At global scope:
/tmp/foo.cc:15:27: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
/tmp/foo.cc:16:22: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
$ g++-mp-4.8 --version
g++-mp-4.8 (GCC) 4.8.0 20120318 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.