This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/82039] -Wzero-as-null-pointer-constant triggers when calling std::allocate<...>::allocate
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 31 Aug 2017 10:58:57 +0000
- Subject: [Bug c++/82039] -Wzero-as-null-pointer-constant triggers when calling std::allocate<...>::allocate
- Auto-submitted: auto-generated
- References: <bug-82039-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82039
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Minimal testcase for the front-end bug:
template<typename T> void f(void* = 0) { }
int main()
{
f<int>();
}
loc.cc: In function 'void f(void*) [with T = int]':
loc.cc:4:10: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
f<int>();
^
It's not useful to show the call site, since that isn't where the
null-pointer-constant is. The first line even says "In function ..." but then
the loc.cc:4:10 locus and the caret show a location that isn't in that function
at all.