[PATCH] PR c++/82039 suppress -Wzero-as-null-pointer-constant warning
Jonathan Wakely
jwakely@redhat.com
Thu Aug 31 16:47:00 GMT 2017
This avoids an unhelpful warning from a system header. Users can't
change the code to avoid the warning, and we don't want to change it
(because it needs to work for C++98 as well as later versions).
PR c++/82039
* include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate):
Adjust null pointer constant to avoid warning
Tested powerpc64le-linux, committed to trunk.
-------------- next part --------------
commit 84cedda4ddf90070f8b5d9132be1bf401183cf1c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Aug 31 12:25:34 2017 +0100
PR c++/82039 suppress -Wzero-as-null-pointer-constant warning
PR c++/82039
* include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate):
Adjust null pointer constant to avoid warning.
diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h
index ee64b9c6447..e1e152c4bf0 100644
--- a/libstdc++-v3/include/ext/new_allocator.h
+++ b/libstdc++-v3/include/ext/new_allocator.h
@@ -96,7 +96,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: __n is permitted to be 0. The C++ standard says nothing
// about what the return value is when __n == 0.
pointer
- allocate(size_type __n, const void* = 0)
+ allocate(size_type __n, const void* = static_cast<const void*>(0))
{
if (__n > this->max_size())
std::__throw_bad_alloc();
More information about the Libstdc++
mailing list