Debian Codegraph @

libstdc++-v3/testsuite/experimental/scopeguard/114152.cc

raw
1 // { dg-do compile { target c++20 } }
2
3 // PR libstdc++/114152
4 // Wrong exception specifiers for LFTSv3 scope guard destructors
5
6 #include <experimental/scope>
7
8 using namespace std::experimental;
9
10 struct F {
11 void operator()() noexcept(false);
12 };
13
14 static_assert( noexcept(std::declval<scope_exit<F>&>().~scope_exit()) );
15 static_assert( noexcept(std::declval<scope_fail<F>&>().~scope_fail()) );
16 static_assert( ! noexcept(std::declval<scope_success<F>&>().~scope_success()) );
17
18 struct G {
19 void operator()() noexcept(true);
20 };
21
22 static_assert( noexcept(std::declval<scope_exit<G>&>().~scope_exit()) );
23 static_assert( noexcept(std::declval<scope_fail<G>&>().~scope_fail()) );
24 static_assert( noexcept(std::declval<scope_success<G>&>().~scope_success()) );