diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2018-04-10 22:34:06 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2018-04-10 22:34:06 +0000 |
commit | 310e77fe20f20da1cfcb6adb44ac52ccd127ed58 (patch) | |
tree | 3fef46997eb34456d711d31cce93f3b8cdf76444 /gcc | |
parent | 6f47ccff0e9c4dab5e9929affa99927e91c51c3c (diff) | |
download | gcc-310e77fe20f20da1cfcb6adb44ac52ccd127ed58.zip gcc-310e77fe20f20da1cfcb6adb44ac52ccd127ed58.tar.gz gcc-310e77fe20f20da1cfcb6adb44ac52ccd127ed58.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/init.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-7.C | 5 |
4 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0f93be7..78e7ed7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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> PR debug/65821 - wrong location for main(). diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5bc8394..52a927e 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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 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)); else if (SCALAR_TYPE_P (type)) init = fold (convert (type, integer_zero_node)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8de596e..a311de0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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> * gcc.target/powerpc/dfmode_off.c: Add -fno-asynchronous-unwind-tables. diff --git a/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-7.C b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-7.C new file mode 100644 index 0000000..808b85b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wzero-as-null-pointer-constant-7.C @@ -0,0 +1,5 @@ +// PR c++/70808 +// { dg-options "-Wzero-as-null-pointer-constant" } + +int* no_warn = {}; +decltype( nullptr ) warn = {}; |