Skip to content

Commit 01540ec

Browse files
committed
Test more not_fns for emptiness
Comment: #86133 (comment)
1 parent 7ea0b51 commit 01540ec

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

libcxx/test/libcxx/utilities/function.objects/func.not.fn/not_fn.nttp.compile.pass.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,27 @@
1717

1818
struct NonEmptyFunctionObject {
1919
bool val = true;
20-
bool operator()() const; // not defined
20+
bool operator()() const;
21+
};
22+
23+
bool func();
24+
25+
struct SomeClass {
26+
bool member_object;
27+
bool member_function();
2128
};
2229

2330
using ResultWithEmptyFuncObject = decltype(std::not_fn<std::false_type{}>());
2431
static_assert(std::is_empty_v<ResultWithEmptyFuncObject>);
2532

2633
using ResultWithNotEmptyFuncObject = decltype(std::not_fn<NonEmptyFunctionObject{}>());
2734
static_assert(std::is_empty_v<ResultWithNotEmptyFuncObject>);
35+
36+
using ResultWithFunctionPointer = decltype(std::not_fn<&func>());
37+
static_assert(std::is_empty_v<ResultWithFunctionPointer>);
38+
39+
using ResultWithMemberObjectPointer = decltype(std::not_fn<&SomeClass::member_object>());
40+
static_assert(std::is_empty_v<ResultWithMemberObjectPointer>);
41+
42+
using ResultWithMemberFunctionPointer = decltype(std::not_fn<&SomeClass::member_function>());
43+
static_assert(std::is_empty_v<ResultWithMemberFunctionPointer>);

0 commit comments

Comments
 (0)