From: Jason Merrill Date: Mon, 10 Nov 2014 05:00:05 +0000 (-0500) Subject: DR 799 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d1301f28c1830acfdffaef0d93e3741b095a31c;p=gcc.git DR 799 DR 799 * typeck.c (build_reinterpret_cast_1): reinterpret_cast to the same scalar type is an rvalue. From-SVN: r217276 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f92e002d19a..dd0dc2f76d9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-11-09 Jason Merrill + DR 799 + * typeck.c (build_reinterpret_cast_1): reinterpret_cast to the + same scalar type is an rvalue. + DR 2007 * call.c (build_new_op_1): Don't do non-class lookup for =, -> or []. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 99f4b8830d2..d0f5ccdc07a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -6898,7 +6898,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, || TYPE_PTR_OR_PTRMEM_P (type)) && same_type_p (type, intype)) /* 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)) || (TYPE_PTRMEMFUNC_P (type) && TYPE_PTRMEMFUNC_P (intype))) return fold_if_not_in_template (build_nop (type, expr)); diff --git a/gcc/testsuite/g++.dg/conversion/reinterpret1.C b/gcc/testsuite/g++.dg/conversion/reinterpret1.C index aa55f6f4cf5..d4567822e2a 100644 --- a/gcc/testsuite/g++.dg/conversion/reinterpret1.C +++ b/gcc/testsuite/g++.dg/conversion/reinterpret1.C @@ -3,4 +3,4 @@ struct Y { Y(int &); }; int v; -Y y1(reinterpret_cast(v)); +Y y1(reinterpret_cast(v)); // { dg-error "" }