diff options
Diffstat (limited to 'test/CXX/special/class.copy/p15-0x.cpp')
-rw-r--r-- | test/CXX/special/class.copy/p15-0x.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CXX/special/class.copy/p15-0x.cpp b/test/CXX/special/class.copy/p15-0x.cpp index 32b2714fd7..fff8844255 100644 --- a/test/CXX/special/class.copy/p15-0x.cpp +++ b/test/CXX/special/class.copy/p15-0x.cpp @@ -16,3 +16,26 @@ namespace PR10622 { bar obj2(obj); } } + +namespace PR11418 { + template<typename T> + T may_throw() { + return T(); + } + + template<typename T> T &&declval() noexcept; + + struct NonPOD { + NonPOD(); + NonPOD(const NonPOD &) noexcept; + NonPOD(NonPOD &&) noexcept; + }; + + struct X { + NonPOD np = may_throw<NonPOD>(); + }; + + static_assert(noexcept(declval<X>()), "noexcept isn't working at all"); + static_assert(noexcept(X(declval<X&>())), "copy constructor can't throw"); + static_assert(noexcept(X(declval<X>())), "move constructor can't throw"); +} |