aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-06-29 00:11:03 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-06-29 00:11:03 +0000
commita5e90b2af35e879ce1f310c0639f907009b6c3cb (patch)
tree2d9629e027b6b3b04e0ce3733a3886cd5b90c184 /gcc/cp/class.c
parente6631d3801d00b095af3325d69b9b4cbdc48535f (diff)
downloadgcc-a5e90b2af35e879ce1f310c0639f907009b6c3cb.zip
gcc-a5e90b2af35e879ce1f310c0639f907009b6c3cb.tar.gz
gcc-a5e90b2af35e879ce1f310c0639f907009b6c3cb.tar.bz2
re PR c++/57645 (Explicitly-declared destructor with no exception specification is always noexcept(true))
/cp 2013-06-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/57645 * class.c (deduce_noexcept_on_destructors): Save, set, and restore TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) around the main loop over the destructors. /testsuite 2013-06-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/57645 * g++.dg/cpp0x/noexcept21.C: New. From-SVN: r200559
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 0067605..bb2c3fe 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4593,15 +4593,20 @@ deduce_noexcept_on_destructor (tree dtor)
static void
deduce_noexcept_on_destructors (tree t)
{
- tree fns;
-
/* If for some reason we don't have a CLASSTYPE_METHOD_VEC, we bail
out now. */
if (!CLASSTYPE_METHOD_VEC (t))
return;
- for (fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
+ bool saved_nontrivial_dtor = TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t);
+
+ /* Avoid early exit from synthesized_method_walk (c++/57645). */
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = true;
+
+ for (tree fns = CLASSTYPE_DESTRUCTORS (t); fns; fns = OVL_NEXT (fns))
deduce_noexcept_on_destructor (OVL_CURRENT (fns));
+
+ TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) = saved_nontrivial_dtor;
}
/* Subroutine of set_one_vmethod_tm_attributes. Search base classes