Commit 310e77fe by Paolo Carlini Committed by Paolo Carlini

re PR c++/70808 (Spurious -Wzero-as-null-pointer-constant for nullptr_t)

/cp
2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70808
	* init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
	the type like TYPE_PTR_OR_PTRMEM_P.

/testsuite
2018-04-10  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/70808
	* g++.dg/warn/Wzero-as-null-pointer-constant-7.C: New.

From-SVN: r259303
parent 6f47ccff
2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70808
* init.c (build_zero_init_1): Handle NULLPTR_TYPE_P being true of
the type like TYPE_PTR_OR_PTRMEM_P.
2018-04-10 Jason Merrill <jason@redhat.com> 2018-04-10 Jason Merrill <jason@redhat.com>
PR debug/65821 - wrong location for main(). PR debug/65821 - wrong location for main().
......
...@@ -180,7 +180,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p, ...@@ -180,7 +180,7 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
items with static storage duration that are not otherwise items with static storage duration that are not otherwise
initialized are initialized to zero. */ initialized are initialized to zero. */
; ;
else if (TYPE_PTR_OR_PTRMEM_P (type)) else if (TYPE_PTR_OR_PTRMEM_P (type) || NULLPTR_TYPE_P (type))
init = fold (convert (type, nullptr_node)); init = fold (convert (type, nullptr_node));
else if (SCALAR_TYPE_P (type)) else if (SCALAR_TYPE_P (type))
init = fold (convert (type, integer_zero_node)); init = fold (convert (type, integer_zero_node));
......
2018-04-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/70808
* g++.dg/warn/Wzero-as-null-pointer-constant-7.C: New.
2018-04-10 Segher Boessenkool <segher@kernel.crashing.org> 2018-04-10 Segher Boessenkool <segher@kernel.crashing.org>
* gcc.target/powerpc/dfmode_off.c: Add -fno-asynchronous-unwind-tables. * gcc.target/powerpc/dfmode_off.c: Add -fno-asynchronous-unwind-tables.
......
// PR c++/70808
// { dg-options "-Wzero-as-null-pointer-constant" }
int* no_warn = {};
decltype( nullptr ) warn = {};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment