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

From-SVN: r217276
This commit is contained in:
Jason Merrill 2014-11-10 00:00:05 -05:00 committed by Jason Merrill
parent e19264356f
commit 6d1301f28c
3 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
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 [].

View File

@ -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));

View File

@ -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 "" }