This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82039] -Wzero-as-null-pointer-constant triggers when calling std::allocate<...>::allocate


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]