Commit 7c0b157d by Jason Merrill Committed by Jason Merrill

re PR c++/56998 (ICE in value_dependent_expression_p, at cp/pt.c:19598)

	PR c++/56998
	* call.c (null_ptr_cst_p): An expression with side-effects can't
	be a C++03 null pointer constant.

From-SVN: r198845
parent 783faa47
2013-05-13 Jason Merrill <jason@redhat.com> 2013-05-13 Jason Merrill <jason@redhat.com>
PR c++/56998
* call.c (null_ptr_cst_p): An expression with side-effects can't
be a C++03 null pointer constant.
PR c++/57041 PR c++/57041
* decl.c (reshape_init_class): Handle error_mark_node. * decl.c (reshape_init_class): Handle error_mark_node.
......
...@@ -554,7 +554,7 @@ null_ptr_cst_p (tree t) ...@@ -554,7 +554,7 @@ null_ptr_cst_p (tree t)
if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t))) if (CP_INTEGRAL_TYPE_P (TREE_TYPE (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 (cxx_dialect < cxx0x) if (cxx_dialect < cxx0x && !TREE_SIDE_EFFECTS (t))
t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none)); t = maybe_constant_value (fold_non_dependent_expr_sfinae (t, tf_none));
STRIP_NOPS (t); STRIP_NOPS (t);
if (integer_zerop (t) && !TREE_OVERFLOW (t)) if (integer_zerop (t) && !TREE_OVERFLOW (t))
......
// PR c++/56998
class Secret;
char IsNullLiteralHelper(Secret* p);
char (&IsNullLiteralHelper(...))[2];
struct C
{
int val() { return 42; }
};
template <typename T>
unsigned f()
{
return sizeof(IsNullLiteralHelper(C().val()));
}
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