* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72494
138bc75d-0d04-0410-961f-
82ee72b054a4
+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)
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;
{
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;