From bb828cc7f3150eee83a0f3d4d26a85806d93fb0c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 5 Mar 2012 13:07:12 -0500 Subject: method.c (synthesized_method_walk): Cleanups don't affect the EH spec either. * method.c (synthesized_method_walk): Cleanups don't affect the EH spec either. From-SVN: r184945 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/method.c | 7 +++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/implicit13.C | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit13.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f837570..71af797 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-05 Jason Merrill + + * method.c (synthesized_method_walk): Cleanups don't affect the EH + spec either. + 2012-03-03 Jason Merrill * init.c (perform_member_init): Cope with uninstantiated NSDMI. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index cf2a713..0718916 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1272,8 +1272,11 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, rval = locate_fn_flags (base_binfo, complete_dtor_identifier, NULL_TREE, flags, complain); /* Note that we don't pass down trivial_p; the subobject - destructors don't affect triviality of the constructor. */ - process_subob_fn (rval, false, spec_p, NULL, + destructors don't affect triviality of the constructor. Nor + do they affect constexpr-ness (a constant expression doesn't + throw) or exception-specification (a throw from one of the + dtors would be a double-fault). */ + process_subob_fn (rval, false, NULL, NULL, deleted_p, NULL, NULL, basetype); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 85a4410..5fbd14f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-03-05 Jason Merrill + + * g++.dg/cpp0x/implicit13.C: New. + 2012-03-05 Jakub Jelinek PR tree-optimization/51721 diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit13.C b/gcc/testsuite/g++.dg/cpp0x/implicit13.C new file mode 100644 index 0000000..96bc770 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit13.C @@ -0,0 +1,24 @@ +// Make sure that A's destructor doesn't affect constexpr +// or exception-spec on D's default constructor. +// { dg-do compile { target c++11 } } + +struct A { + constexpr A() noexcept: i(0) { } + int i; + ~A() noexcept(false); +}; + +struct B: A { }; + +// Should get static initialization, so no constructor call. +// { dg-final { scan-assembler-not "_ZN1BC1Ev" } } +B b; + +struct C { C() noexcept; ~C(); }; +struct D: C { }; +extern D d; + +void *operator new(__SIZE_TYPE__, void*) noexcept; + +#define SA(X) static_assert((X),#X) +SA(noexcept(new (&d) D)); -- cgit v1.1