aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/tree.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 856e8c7..ff3ad54 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/48873
+ * tree.c (stabilize_expr): Don't make gratuitous copies of classes.
+
2011-05-05 Eric Botcazou <ebotcazou@adacore.com>
* decl.c (start_preparsed_function): Do not set
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 0f2f86c..9a6e26d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -3119,7 +3119,10 @@ stabilize_expr (tree exp, tree* initp)
if (!TREE_SIDE_EFFECTS (exp))
init_expr = NULL_TREE;
- else if (!TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (exp))
+ /* There are no expressions with REFERENCE_TYPE, but there can be call
+ arguments with such a type; just treat it as a pointer. */
+ else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
+ || SCALAR_TYPE_P (exp)
|| !lvalue_or_rvalue_with_address_p (exp))
{
init_expr = get_target_expr (exp);