From: Jason Merrill Date: Wed, 21 Sep 2016 19:49:32 +0000 (-0400) Subject: Core 903 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c67c64efbe7082e3453f24016795af52179317b2;p=gcc.git Core 903 Core 903 * call.c (null_ptr_cst_p): Check char_type_p. From-SVN: r240329 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6bafde59893..61d41e739ad 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2016-09-21 Jason Merrill + + Core 903 + * call.c (null_ptr_cst_p): Check char_type_p. + 2016-09-21 Jakub Jelinek PR c++/77651 diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b6f65d2fe05..c2365802103 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 00000000000..5f4388195ad --- /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" }