commit d2f237ef0f63b3ee3da79bcbfad08fedb325d554 Author: Jason Merrill Date: Wed Sep 21 10:58:39 2016 -0400 Core 903 * call.c (null_ptr_cst_p): Check char_type_p. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 393aab9..2804bd8 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" }