aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-10-14 16:46:27 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-10-14 16:46:27 -0400
commit182609b572ff4cb8a4be98163ec05b4713bb1cd2 (patch)
treea6545c06fe6fd6a7a5f7ac9db6594008ad5c3758 /gcc
parenta5e6b29b07b0971b9a8a49d65d342407deef89c5 (diff)
downloadgcc-182609b572ff4cb8a4be98163ec05b4713bb1cd2.zip
gcc-182609b572ff4cb8a4be98163ec05b4713bb1cd2.tar.gz
gcc-182609b572ff4cb8a4be98163ec05b4713bb1cd2.tar.bz2
re PR c++/11878 (ICE in cp_expr_size)
PR c++/11878 * tree.c (build_target_expr_with_type): Call force_rvalue for classes with non-trivial copy ctors. PR c++/11063 * typeck.c (build_modify_expr): Call convert rather than abort. From-SVN: r72494
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/tree.c6
-rw-r--r--gcc/cp/typeck.c5
3 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2cb9001..86d4364 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2003-10-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/11878
+ * tree.c (build_target_expr_with_type): Call force_rvalue for
+ classes with non-trivial copy ctors.
+
+ PR c++/11063
+ * typeck.c (build_modify_expr): Call convert rather than abort.
+
2003-10-14 Gabriel Dos Reis <gdr@integrable-solutions.net>
Breack out decl.c (3/n)
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index f99b316..8445d7e 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -310,6 +310,12 @@ build_target_expr_with_type (tree init, tree type)
if (TREE_CODE (init) == TARGET_EXPR)
return init;
+ else if (CLASS_TYPE_P (type) && !TYPE_HAS_TRIVIAL_INIT_REF (type)
+ && TREE_CODE (init) != COND_EXPR)
+ /* We need to build up a copy constructor call. COND_EXPR is a special
+ case because we already have copies on the arms and we don't want
+ another one here. */
+ return force_rvalue (init);
slot = build_decl (VAR_DECL, NULL_TREE, type);
DECL_ARTIFICIAL (slot) = 1;
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 25d6ac4..a5301df 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4991,8 +4991,9 @@ build_modify_expr (tree lhs, enum tree_code modifycode, tree rhs)
{
if (TREE_CODE (rhs) == CONSTRUCTOR)
{
- my_friendly_assert (same_type_p (TREE_TYPE (rhs), lhstype),
- 20011220);
+ if (! same_type_p (TREE_TYPE (rhs), lhstype))
+ /* Call convert to generate an error; see PR 11063. */
+ rhs = convert (lhstype, rhs);
result = build (INIT_EXPR, lhstype, lhs, rhs);
TREE_SIDE_EFFECTS (result) = 1;
return result;