This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/82039] New: -Wzero-as-null-pointer-constant triggers when calling std::allocate<...>::allocate
- From: "max at maxbruckner dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 30 Aug 2017 17:18:20 +0000
- Subject: [Bug libstdc++/82039] New: -Wzero-as-null-pointer-constant triggers when calling std::allocate<...>::allocate
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82039
Bug ID: 82039
Summary: -Wzero-as-null-pointer-constant triggers when calling
std::allocate<...>::allocate
Product: gcc
Version: 7.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: max at maxbruckner dot de
Target Milestone: ---
Created attachment 42087
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42087&action=edit
Code to reproduce the problem
gcc 7.1.1 emits a warning when enabling -Wzero-as-null-pointer-constant and
calling the allocate member function of std::allocator provided by libstdc++.
This only happens when calling allocate with only one parameter. So a
workaround is calling it with the second parameter set to nullptr.
I think this is due to the default parameter for the second parameter being a 0
instead of nullptr (not sure though, since I couldn't find the actual
implementation in the header files.