Commit 76187e87 by Jason Merrill Committed by Jason Merrill

re PR c++/41449 (Partial aggregate initialization not cleaned up on exception)

	PR c++/41449
	* typeck2.c (split_nonconstant_init_1): Handle EH cleanup of
	initialized subobjects.

From-SVN: r180267
parent 5dea5b2a
2011-10-20 Jason Merrill <jason@redhat.com>
PR c++/41449
* typeck2.c (split_nonconstant_init_1): Handle EH cleanup of
initialized subobjects.
2011-10-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/13657
......
......@@ -567,6 +567,13 @@ split_nonconstant_init_1 (tree dest, tree init)
code = build2 (INIT_EXPR, inner_type, sub, value);
code = build_stmt (input_location, EXPR_STMT, code);
add_stmt (code);
if (!TYPE_HAS_TRIVIAL_DESTRUCTOR (inner_type))
{
code = (build_special_member_call
(sub, complete_dtor_identifier, NULL, inner_type,
LOOKUP_NORMAL, tf_warning_or_error));
finish_eh_cleanup (code);
}
num_split_elts++;
}
......
2011-10-20 Jason Merrill <jason@redhat.com>
PR c++/41449
* g++.dg/eh/partial1.C: New.
2011-10-20 Richard Henderson <rth@redhat.com>
* gcc.target/i386/vperm-v2df.c, gcc.target/i386/vperm-v2di.c,
......
// PR c++/41449
// { dg-do run }
struct A
{
A() {}
A(const A&) { throw 1; }
};
int bs;
struct B
{
B() { ++bs; }
B(const B&) { ++bs; }
~B() { --bs; }
};
struct C
{
B b1;
A a;
B b2;
};
int main()
{
{
B b1, b2;
A a;
try {
C c = { b1, a, b2 };
} catch (...) {}
}
if (bs != 0)
__builtin_abort ();
}
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