Commit c67c64ef by Jason Merrill Committed by Jason Merrill

Core 903

	Core 903
	* call.c (null_ptr_cst_p): Check char_type_p.

From-SVN: r240329
parent 5f84cee2
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> 2016-09-21 Jakub Jelinek <jakub@redhat.com>
PR c++/77651 PR c++/77651
......
...@@ -527,6 +527,7 @@ null_ptr_cst_p (tree t) ...@@ -527,6 +527,7 @@ null_ptr_cst_p (tree t)
{ {
/* Core issue 903 says only literal 0 is a null pointer constant. */ /* Core issue 903 says only literal 0 is a null pointer constant. */
if (TREE_CODE (type) == INTEGER_TYPE if (TREE_CODE (type) == INTEGER_TYPE
&& !char_type_p (type)
&& TREE_CODE (t) == INTEGER_CST && TREE_CODE (t) == INTEGER_CST
&& integer_zerop (t) && integer_zerop (t)
&& !TREE_OVERFLOW (t)) && !TREE_OVERFLOW (t))
......
// { dg-do compile { target c++11 } }
void *p = '\0'; // { dg-error "invalid conversion" }
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