diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-06 05:04:56 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-05-06 05:04:56 +0000 |
commit | 2b45b267dab44442dbe68708be54e7d85e1b04dd (patch) | |
tree | f746cc2cafa1fe7af20fbd93f3aa0f17cee1cd90 /clang/test/CXX/except/except.spec/p14.cpp | |
parent | 7d02ca48789e7963c9239a1d2f7e9c833b0aa3b1 (diff) | |
download | bcm5719-llvm-2b45b267dab44442dbe68708be54e7d85e1b04dd.tar.gz bcm5719-llvm-2b45b267dab44442dbe68708be54e7d85e1b04dd.zip |
P1286R2: Remove restriction that the exception specification of a
defaulted special member matches the implicit exception specification.
llvm-svn: 360011
Diffstat (limited to 'clang/test/CXX/except/except.spec/p14.cpp')
-rw-r--r-- | clang/test/CXX/except/except.spec/p14.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/clang/test/CXX/except/except.spec/p14.cpp b/clang/test/CXX/except/except.spec/p14.cpp index c717d977979..b1c8b207b4a 100644 --- a/clang/test/CXX/except/except.spec/p14.cpp +++ b/clang/test/CXX/except/except.spec/p14.cpp @@ -83,7 +83,12 @@ namespace PR14141 { Derived &operator=(const Derived&) noexcept(false) = default; Derived &operator=(Derived&&) noexcept(false) = default; ~Derived() noexcept(false) = default; - }; + } d1; + static_assert(!noexcept(Derived()), ""); + static_assert(!noexcept(Derived(static_cast<Derived&&>(d1))), ""); + static_assert(!noexcept(Derived(d1)), ""); + static_assert(!noexcept(d1 = static_cast<Derived&&>(d1)), ""); + static_assert(!noexcept(d1 = d1), ""); struct Derived2 : ThrowingBase { Derived2() = default; Derived2(const Derived2&) = default; @@ -91,15 +96,21 @@ namespace PR14141 { Derived2 &operator=(const Derived2&) = default; Derived2 &operator=(Derived2&&) = default; ~Derived2() = default; - }; + } d2; + static_assert(!noexcept(Derived2()), ""); + static_assert(!noexcept(Derived2(static_cast<Derived2&&>(d2))), ""); + static_assert(!noexcept(Derived2(d2)), ""); + static_assert(!noexcept(d2 = static_cast<Derived2&&>(d2)), ""); + static_assert(!noexcept(d2 = d2), ""); struct Derived3 : ThrowingBase { - Derived3() noexcept(true) = default; // expected-error {{does not match the calculated}} - Derived3(const Derived3&) noexcept(true) = default; // expected-error {{does not match the calculated}} - Derived3(Derived3&&) noexcept(true) = default; // expected-error {{does not match the calculated}} - Derived3 &operator=(const Derived3&) noexcept(true) = default; // expected-error {{does not match the calculated}} - Derived3 &operator=(Derived3&&) noexcept(true) = default; // expected-error {{does not match the calculated}} - ~Derived3() noexcept(true) = default; // expected-error {{does not match the calculated}} - }; + Derived3() noexcept(true) = default; + Derived3(const Derived3&) noexcept(true) = default; + Derived3(Derived3&&) noexcept(true) = default; + Derived3 &operator=(const Derived3&) noexcept(true) = default; + Derived3 &operator=(Derived3&&) noexcept(true) = default; + ~Derived3() noexcept(true) = default; + } d3; + static_assert(noexcept(Derived3(), Derived3(Derived3()), Derived3(d3), d3 = Derived3(), d3 = d3), ""); } namespace rdar13017229 { |