Skip to content

Commit e045e2e

Browse files
committed
Add extra noexcept test
1 parent d92507c commit e045e2e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

libcxx/test/std/utilities/function.objects/func.not_fn/not_fn.nttp.pass.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ struct MaybeNoexceptFn {
4747
bool operator()() const noexcept(IsNoexcept); // not defined
4848
};
4949

50+
template <bool IsNoexcept>
51+
struct MaybeNoexceptNegation {
52+
bool operator!() noexcept(IsNoexcept); // not defined
53+
};
54+
55+
template <bool IsNoexcept>
56+
MaybeNoexceptNegation<IsNoexcept> maybe_noexcept_negation() noexcept; // not defined
57+
5058
constexpr void basic_tests() {
5159
{ // Test constant functions
5260
auto false_fn = std::not_fn<std::false_type{}>();
@@ -267,6 +275,12 @@ constexpr void test_return_type() {
267275

268276
auto never_noexcept = std::not_fn<MaybeNoexceptFn<false>{}>();
269277
static_assert(!noexcept(never_noexcept()));
278+
279+
auto always_noexcept_negation = std::not_fn<maybe_noexcept_negation<true>>();
280+
static_assert(noexcept(always_noexcept_negation()));
281+
282+
auto never_noexcept_negation = std::not_fn<maybe_noexcept_negation<false>>();
283+
static_assert(!noexcept(never_noexcept_negation()));
270284
}
271285

272286
{ // Test calling volatile wrapper

0 commit comments

Comments
 (0)