diff options
author | Jason Merrill <jason@redhat.com> | 2016-09-21 15:49:32 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-09-21 15:49:32 -0400 |
commit | c67c64efbe7082e3453f24016795af52179317b2 (patch) | |
tree | ed841fcb7e9f4d4e29259a606e9c0c0b12cdf9ff /gcc | |
parent | 5f84cee259d615b36a673aa6d712ebaf9fb90fd9 (diff) | |
download | gcc-c67c64efbe7082e3453f24016795af52179317b2.zip gcc-c67c64efbe7082e3453f24016795af52179317b2.tar.gz gcc-c67c64efbe7082e3453f24016795af52179317b2.tar.bz2 |
Core 903
Core 903
* call.c (null_ptr_cst_p): Check char_type_p.
From-SVN: r240329
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/nullptr36.C | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6bafde5..61d41e7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-09-21 Jason Merrill <jason@redhat.com> + + Core 903 + * call.c (null_ptr_cst_p): Check char_type_p. + 2016-09-21 Jakub Jelinek <jakub@redhat.com> PR c++/77651 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b6f65d2..c236580 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -527,6 +527,7 @@ null_ptr_cst_p (tree t) { /* Core issue 903 says only literal 0 is a null pointer constant. */ if (TREE_CODE (type) == INTEGER_TYPE + && !char_type_p (type) && TREE_CODE (t) == INTEGER_CST && integer_zerop (t) && !TREE_OVERFLOW (t)) diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr36.C b/gcc/testsuite/g++.dg/cpp0x/nullptr36.C new file mode 100644 index 0000000..5f43881 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr36.C @@ -0,0 +1,3 @@ +// { dg-do compile { target c++11 } } + +void *p = '\0'; // { dg-error "invalid conversion" } |