aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2016-04-20 15:30:47 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2016-04-20 15:30:47 +0000
commit323af7cfa7b64967d997388be9e564de57e46e2b (patch)
tree2de7320e1082ee8b23d4a56a54cdefe31c759a55 /gcc
parent9023fd9ea0fb53c88e1fd7279b31e3be53cd4aab (diff)
downloadgcc-323af7cfa7b64967d997388be9e564de57e46e2b.zip
gcc-323af7cfa7b64967d997388be9e564de57e46e2b.tar.gz
gcc-323af7cfa7b64967d997388be9e564de57e46e2b.tar.bz2
semantics.c (finish_compound_lteral): Don't wrap VECTOR_TYPEs in a TARGET_EXPR.
* semantics.c (finish_compound_lteral): Don't wrap VECTOR_TYPEs in a TARGET_EXPR. From-SVN: r235288
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/semantics.c13
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 73b1cfa..008bc35 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-04-20 Nathan Sidwell <nathan@acm.org>
+
+ * semantics.c (finish_compound_lteral): Don't wrap VECTOR_TYPEs in a
+ TARGET_EXPR.
+
2016-04-19 Jason Merrill <jason@redhat.com>
PR c++/66543
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 85ef993..1dff08e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2732,8 +2732,8 @@ finish_compound_literal (tree type, tree compound_literal,
compound_literal = digest_init (type, compound_literal, complain);
if (TREE_CODE (compound_literal) == CONSTRUCTOR)
TREE_HAS_CONSTRUCTOR (compound_literal) = true;
- /* Put static/constant array temporaries in static variables, but always
- represent class temporaries with TARGET_EXPR so we elide copies. */
+
+ /* Put static/constant array temporaries in static variables. */
if ((!at_function_scope_p () || CP_TYPE_CONST_P (type))
&& TREE_CODE (type) == ARRAY_TYPE
&& !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
@@ -2763,8 +2763,13 @@ finish_compound_literal (tree type, tree compound_literal,
return error_mark_node;
return decl;
}
- else
- return get_target_expr_sfinae (compound_literal, complain);
+
+ /* Represent other compound literals with TARGET_EXPR so we produce
+ an lvalue, but can elide copies. */
+ if (!VECTOR_TYPE_P (type))
+ compound_literal = get_target_expr_sfinae (compound_literal, complain);
+
+ return compound_literal;
}
/* Return the declaration for the function-name variable indicated by