[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / exception-spec.cpp
blob6ad19aab397bd66dacb7cb68ca7cee1387b5ee0a
1 // RUN: %clang_cc1 -fsyntax-only -verify -fcxx-exceptions -std=c++11 %s
3 namespace MissingOnTemplate {
4 template<typename T> void foo(T) noexcept(true); // expected-note {{previous}}
5 template<typename T> void foo(T); // expected-error {{missing exception specification 'noexcept(true)'}}
6 void test() { foo(0); }
9 struct UseBeforeComplete1 {
10 ~UseBeforeComplete1(); // expected-note {{previous}}
11 struct X {
12 friend UseBeforeComplete1::~UseBeforeComplete1() noexcept; // expected-warning {{previously declared with an implicit}}
16 struct ThrowingDtor { ~ThrowingDtor() noexcept(false); };
17 struct UseBeforeComplete2 {
18 ~UseBeforeComplete2(); // expected-note {{previous}}
19 struct X {
20 friend UseBeforeComplete2::~UseBeforeComplete2() noexcept; // expected-error {{does not match previous}}
22 ThrowingDtor td;
25 struct UseBeforeComplete3 {
26 ~UseBeforeComplete3();
27 struct X {
28 friend UseBeforeComplete3::~UseBeforeComplete3(); // ok, implicitly noexcept(true)
31 static_assert(noexcept(UseBeforeComplete3()), "");
33 struct UseBeforeComplete4 {
34 ~UseBeforeComplete4();
35 struct X {
36 friend UseBeforeComplete4::~UseBeforeComplete4(); // ok, implicitly noexcept(false)
38 ThrowingDtor td;
40 static_assert(!noexcept(UseBeforeComplete4()), "");
42 namespace AssignmentOp {
43 struct D1;
44 struct D2;
45 struct B {
46 B &operator=(const B&);
47 virtual D1 &operator=(const D1&) noexcept; // expected-note {{overridden}}
48 virtual D2 &operator=(const D2&) noexcept; // expected-note {{overridden}}
50 struct D1 : B {}; // expected-error {{more lax}}
51 struct D2 : B {
52 D2 &operator=(const D2&); // expected-error {{more lax}}