22 lines · cpp
1// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only %s -fcxx-exceptions -fassume-nothrow-exception-dtor -verify2 3namespace test1 {4template <typename T> struct A { A(); ~A(); };5struct B { ~B() noexcept(false); };6struct B1 : B {};7struct B2 { B b; };8struct C { virtual void f(); } c;9struct MoveOnly { MoveOnly(); MoveOnly(MoveOnly&&); };10void run() {11 throw A<int>();12 throw B(); // expected-error{{cannot throw object of type 'B' with a potentially-throwing destructor}}13 throw new B;14 throw B1(); // expected-error{{cannot throw object of type 'B1' with a potentially-throwing destructor}}15 B2 b2;16 throw b2; // expected-error{{cannot throw object of type 'B2' with a potentially-throwing destructor}}17 throw c;18 MoveOnly m;19 throw m;20}21}22