From 016c12fbe01aad40c31931f191884ddfa457ddc0 Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 10 Jul 2012 00:05:38 +0000 Subject: [PATCH] * method.c (synthesized_method_walk): Cleanups don't affect the EH spec either. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@189397 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/method.c | 11 +++++++---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/implicit13.C | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit13.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c8216f60f08..16460b71201 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-07-10 Jason Merrill + + * method.c (synthesized_method_walk): Cleanups don't affect the EH + spec either. + 2012-07-02 Jason Merrill PR c++/53816 diff --git a/gcc/cp/method.c b/gcc/cp/method.c index be3a77996b3..bb4350065ab 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); } @@ -1320,7 +1323,7 @@ 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); - process_subob_fn (rval, false, spec_p, NULL, + process_subob_fn (rval, false, NULL, NULL, deleted_p, NULL, NULL, basetype); } @@ -1340,7 +1343,7 @@ synthesized_method_walk (tree ctype, special_function_kind sfk, bool const_p, if (ctor_p) walk_field_subobs (TYPE_FIELDS (ctype), complete_dtor_identifier, sfk_destructor, TYPE_UNQUALIFIED, false, - false, false, spec_p, NULL, + false, false, NULL, NULL, deleted_p, NULL, NULL, flags, complain); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e528ead31a..04ab76590ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-07-10 Jason Merrill + + * g++.dg/cpp0x/implicit13.C: New. + 2012-07-09 Janis Johnson Backport from mainline. diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit13.C b/gcc/testsuite/g++.dg/cpp0x/implicit13.C new file mode 100644 index 00000000000..3165863c639 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit13.C @@ -0,0 +1,32 @@ +// 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() noexcept(false); }; +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)); + +struct E: virtual C { }; +extern E e; +SA(noexcept (new (&e) E)); + +struct F { C c; }; +extern F f; +SA(noexcept (new (&f) F)); -- 2.11.0