aboutsummaryrefslogtreecommitdiff
path: root/contrib/gcc/cp/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/cp/init.c')
-rw-r--r--contrib/gcc/cp/init.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c
index 83a87537e8b4..91ea10c16cba 100644
--- a/contrib/gcc/cp/init.c
+++ b/contrib/gcc/cp/init.c
@@ -2517,6 +2517,10 @@ build_new_1 (exp)
element. */
rval = convert (build_pointer_type (type), rval);
+ /* A new-expression is never an lvalue. */
+ if (real_lvalue_p (rval))
+ rval = build1 (NON_LVALUE_EXPR, TREE_TYPE (rval), rval);
+
return rval;
}