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);
}
{
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);
}
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);
--- /dev/null
+// 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));