* cp-lang.c (cp_expr_size): Allow initialization from a
CONSTRUCTOR.
From-SVN: r56720
+2002-08-31 Jason Merrill <jason@redhat.com>
+
+ * cp-lang.c (cp_expr_size): Allow initialization from a
+ CONSTRUCTOR.
+
2002-08-30 Richard Henderson <rth@redhat.com>
PR opt/7515
of a type with both of these set; all copies of such types must go
through a constructor or assignment op. */
if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp))
- && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp)))
+ && TYPE_HAS_COMPLEX_ASSIGN_REF (TREE_TYPE (exp))
+ /* But storing a CONSTRUCTOR isn't a copy. */
+ && TREE_CODE (exp) != CONSTRUCTOR)
abort ();
/* This would be wrong for a type with virtual bases, but they are
caught by the abort above. */
--- /dev/null
+// Test that initializing an aggregate with complex copy constructor
+// and assignment ops doesn't cause cp_expr_size to abort.
+
+struct A
+{
+ A();
+ A(const A&);
+ A& operator=(const A&);
+};
+
+struct B
+{
+ A a;
+};
+
+int main ()
+{
+ B b = { A() };
+}