Commit 6d1301f2 by Jason Merrill Committed by Jason Merrill

DR 799

	DR 799
	* typeck.c (build_reinterpret_cast_1): reinterpret_cast to the
	same scalar type is an rvalue.

From-SVN: r217276
parent e1926435
2014-11-09 Jason Merrill <jason@redhat.com> 2014-11-09 Jason Merrill <jason@redhat.com>
DR 799
* typeck.c (build_reinterpret_cast_1): reinterpret_cast to the
same scalar type is an rvalue.
DR 2007 DR 2007
* call.c (build_new_op_1): Don't do non-class lookup for =, -> or []. * call.c (build_new_op_1): Don't do non-class lookup for =, -> or [].
......
...@@ -6898,7 +6898,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, ...@@ -6898,7 +6898,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
|| TYPE_PTR_OR_PTRMEM_P (type)) || TYPE_PTR_OR_PTRMEM_P (type))
&& same_type_p (type, intype)) && same_type_p (type, intype))
/* DR 799 */ /* DR 799 */
return fold_if_not_in_template (build_nop (type, expr)); return rvalue (expr);
else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype)) else if ((TYPE_PTRFN_P (type) && TYPE_PTRFN_P (intype))
|| (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))) || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype)))
return fold_if_not_in_template (build_nop (type, expr)); return fold_if_not_in_template (build_nop (type, expr));
......
...@@ -3,4 +3,4 @@ ...@@ -3,4 +3,4 @@
struct Y { Y(int &); }; struct Y { Y(int &); };
int v; int v;
Y y1(reinterpret_cast<int>(v)); Y y1(reinterpret_cast<int>(v)); // { dg-error "" }
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