From 62576f0b220e11d7192d789ec337f3732c83c636 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 4 Sep 2017 17:41:38 +0100 Subject: [PATCH] PR c++/82039 suppress -Wzero-as-null-pointer-constant warning Backport from mainline 2017-08-31 Jonathan Wakely PR c++/82039 * include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate): Adjust null pointer constant to avoid warning. From-SVN: r251672 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/ext/new_allocator.h | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d876052b2a86..6ca4a210ede2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2017-09-04 Jonathan Wakely + Backport from mainline + 2017-08-31 Jonathan Wakely + + PR c++/82039 + * include/ext/new_allocator.h (__gnu_cxx::new_allocator::allocate): + Adjust null pointer constant to avoid warning. + Backport from mainline 2017-08-18 Jonathan Wakely diff --git a/libstdc++-v3/include/ext/new_allocator.h b/libstdc++-v3/include/ext/new_allocator.h index 83e3a0b0a8f8..fcc5ff4dae30 100644 --- a/libstdc++-v3/include/ext/new_allocator.h +++ b/libstdc++-v3/include/ext/new_allocator.h @@ -96,8 +96,8 @@ _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(0)) + { if (__n > this->max_size()) std::__throw_bad_alloc(); -- 2.47.2