Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / SemaCXX / assume-nothrow-exception-dtor.cpp
blobdb070310b6096ceb80b9d6bf1c3a5663311e5fc1
1 // RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only %s -fcxx-exceptions -fassume-nothrow-exception-dtor -verify
3 namespace test1 {
4 template <typename T> struct A { A(); ~A(); };
5 struct B { ~B() noexcept(false); };
6 struct B1 : B {};
7 struct B2 { B b; };
8 struct C { virtual void f(); } c;
9 struct MoveOnly { MoveOnly(); MoveOnly(MoveOnly&&); };
10 void 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;