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++/65324] New: -Wzero-as-null-pointer-constant: incorrect location for function templates


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65324

            Bug ID: 65324
           Summary: -Wzero-as-null-pointer-constant: incorrect location
                    for function templates
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akim.demaille at gmail dot com

template <typename T>
void fun(T, void* = 0) {}

int main()
{
  fun(0);
}

g++-mp-5 -O3 -Wzero-as-null-pointer-constant foo.cc 
foo.cc: In function 'void fun(T, void*) [with T = int]':
foo.cc:6:8: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]
   fun(0);
        ^
foo.cc:6:8: warning: zero as null pointer constant
[-Wzero-as-null-pointer-constant]


This is annoying, because it breaks the usefulness of -isystem: Boost still has
places where they use 0 instead of nullptr, in particular in template functions
with default arguments.  This triggers warnings in my own code, instead of in
the library (well, actually, I expect to have none at all in my case, since I
use -isystem).

Thanks!

(And please, note that it stutters too, as in #65323).


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