diff options
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x/noexcept21.C')
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/cpp0x/noexcept21.C | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/noexcept21.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/noexcept21.C new file mode 100644 index 0000000..ec88e1d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/noexcept21.C @@ -0,0 +1,87 @@ +// PR c++/57645 +// { dg-do compile { target c++11 } } + +struct Thrower +{ + ~Thrower() noexcept(false) { throw 1; } +}; + +struct ExplicitA +{ + ~ExplicitA() {} + + Thrower t; +}; + +struct ExplicitB +{ + ~ExplicitB(); + + Thrower t; +}; + +ExplicitB::~ExplicitB() {} + +struct ExplicitC +{ + ~ExplicitC() = default; + + Thrower t; +}; + +struct ExplicitD +{ + ~ExplicitD(); + + Thrower t; +}; + +ExplicitD::~ExplicitD() = default; + +struct NoThrower +{ + ~NoThrower() noexcept(true) {} +}; + +struct ExplicitE +{ + ~ExplicitE() {} + + NoThrower t; +}; + +struct ExplicitF +{ + ~ExplicitF(); + + NoThrower t; +}; + +ExplicitF::~ExplicitF() {} + +struct ExplicitG +{ + ~ExplicitG() = default; + + NoThrower t; +}; + +struct ExplicitH +{ + ~ExplicitH(); + + NoThrower t; +}; + +ExplicitH::~ExplicitH() = default; + +#define SA(X) static_assert(X, #X) + +SA( !noexcept(ExplicitA()) ); +SA( !noexcept(ExplicitB()) ); +SA( !noexcept(ExplicitC()) ); +SA( !noexcept(ExplicitD()) ); +SA( noexcept(ExplicitE()) ); +SA( noexcept(ExplicitF()) ); +SA( noexcept(ExplicitG()) ); +SA( noexcept(ExplicitH()) ); |