2018-11-07 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / noexcept21.C
blobec88e1d3d8739822810bf5287d91e3ff81a067ce
1 // PR c++/57645
2 // { dg-do compile { target c++11 } }
4 struct Thrower
6   ~Thrower() noexcept(false) { throw 1; }
7 };
9 struct ExplicitA
11   ~ExplicitA() {}
13   Thrower t;
16 struct ExplicitB
18   ~ExplicitB();
20   Thrower t;
23 ExplicitB::~ExplicitB() {}
25 struct ExplicitC
27   ~ExplicitC() = default;
29   Thrower t;
32 struct ExplicitD
34   ~ExplicitD();
36   Thrower t;
39 ExplicitD::~ExplicitD() = default;
41 struct NoThrower
43   ~NoThrower() noexcept(true) {}
46 struct ExplicitE
48   ~ExplicitE() {}
50   NoThrower t;
53 struct ExplicitF
55   ~ExplicitF();
57   NoThrower t;
60 ExplicitF::~ExplicitF() {}
62 struct ExplicitG
64   ~ExplicitG() = default;
66   NoThrower t;
69 struct ExplicitH
71   ~ExplicitH();
73   NoThrower t;
76 ExplicitH::~ExplicitH() = default;
78 #define SA(X) static_assert(X, #X)
80 SA( !noexcept(ExplicitA()) );
81 SA( !noexcept(ExplicitB()) );
82 SA( !noexcept(ExplicitC()) );
83 SA( !noexcept(ExplicitD()) );
84 SA( noexcept(ExplicitE()) );
85 SA( noexcept(ExplicitF()) );
86 SA( noexcept(ExplicitG()) );
87 SA( noexcept(ExplicitH()) );