Commit d99f015c by Jason Merrill Committed by Jason Merrill

cp-lang.c (cp_expr_size): Allow initialization from a CONSTRUCTOR.

        * cp-lang.c (cp_expr_size): Allow initialization from a
        CONSTRUCTOR.

From-SVN: r56720
parent ad5aa77e
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> 2002-08-30 Richard Henderson <rth@redhat.com>
PR opt/7515 PR opt/7515
......
...@@ -298,7 +298,9 @@ cp_expr_size (exp) ...@@ -298,7 +298,9 @@ cp_expr_size (exp)
of a type with both of these set; all copies of such types must go of a type with both of these set; all copies of such types must go
through a constructor or assignment op. */ through a constructor or assignment op. */
if (TYPE_HAS_COMPLEX_INIT_REF (TREE_TYPE (exp)) 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 (); abort ();
/* This would be wrong for a type with virtual bases, but they are /* This would be wrong for a type with virtual bases, but they are
caught by the abort above. */ caught by the abort above. */
......
// 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() };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment