+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.
+
2013-06-28 Balaji V. Iyer <balaji.v.iyer@intel.com>
* parser.c (cp_parser_array_notation): Removed rejection array notation
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
+2013-06-28 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/57645
+ * g++.dg/cpp0x/noexcept21.C: New.
+
2013-06-28 Jakub Jelinek <jakub@redhat.com>
PR target/57736
--- /dev/null
+// PR c++/57645
+// { dg-do compile { target c++11 } }
+
+struct Thrower
+{
+ ~Thrower() noexcept(false) { throw 1; }
+};
+
+struct ExplicitA
+{
+ ~ExplicitA() {}
+
+ Thrower t;
+};
+
+struct ExplicitB
+{
+ ~ExplicitB();
+
+ Thrower t;
+};
+
+ExplicitB::~ExplicitB() {}
+
+struct ExplicitC
+{
+ ~ExplicitC() = default;
+
+ Thrower t;
+};
+
+struct ExplicitD
+{
+ ~ExplicitD();
+
+ Thrower t;
+};
+
+ExplicitD::~ExplicitD() = default;
+
+struct NoThrower
+{
+ ~NoThrower() noexcept(true) {}
+};
+
+struct ExplicitE
+{
+ ~ExplicitE() {}
+
+ NoThrower t;
+};
+
+struct ExplicitF
+{
+ ~ExplicitF();
+
+ NoThrower t;
+};
+
+ExplicitF::~ExplicitF() {}
+
+struct ExplicitG
+{
+ ~ExplicitG() = default;
+
+ NoThrower t;
+};
+
+struct ExplicitH
+{
+ ~ExplicitH();
+
+ NoThrower t;
+};
+
+ExplicitH::~ExplicitH() = default;
+
+#define SA(X) static_assert(X, #X)
+
+SA( !noexcept(ExplicitA()) );
+SA( !noexcept(ExplicitB()) );
+SA( !noexcept(ExplicitC()) );
+SA( !noexcept(ExplicitD()) );
+SA( noexcept(ExplicitE()) );
+SA( noexcept(ExplicitF()) );
+SA( noexcept(ExplicitG()) );
+SA( noexcept(ExplicitH()) );