1818#include " test_macros.h"
1919
2020template <class CPO , class ... Args>
21- constexpr bool test (CPO& o, Args&&...) {
21+ constexpr void test (CPO& o, Args&&... args ) {
2222 static_assert (std::is_const_v<CPO>);
2323 static_assert (std::is_class_v<CPO>);
2424 static_assert (std::is_trivially_copyable_v<CPO>);
2525 static_assert (std::is_trivially_default_constructible_v<CPO>);
2626
2727 auto p = o;
2828 using T = decltype (p);
29+ (void )o (args...); // to make sure the CPO can actually be used
2930
3031 // The type of a customization point object, ignoring cv-qualifiers, shall model semiregular.
3132 static_assert (std::semiregular<T>);
@@ -35,26 +36,33 @@ constexpr bool test(CPO& o, Args&&...) {
3536 static_assert (std::invocable<const T&, Args...>);
3637 static_assert (std::invocable<T, Args...>);
3738 static_assert (std::invocable<const T, Args...>);
38-
39- return true ;
4039}
4140
4241int a[10 ];
4342
44- static_assert (test(std::ranges::begin, a));
45- static_assert (test(std::ranges::end, a));
46- static_assert (test(std::ranges::cbegin, a));
47- static_assert (test(std::ranges::cdata, a));
48- static_assert (test(std::ranges::cend, a));
49- static_assert (test(std::ranges::crbegin, a));
50- static_assert (test(std::ranges::crend, a));
51- static_assert (test(std::ranges::data, a));
52- static_assert (test(std::ranges::empty, a));
53- static_assert (test(std::ranges::rbegin, a));
54- static_assert (test(std::ranges::rend, a));
55- static_assert (test(std::ranges::size, a));
56- static_assert (test(std::ranges::ssize, a));
43+ constexpr bool test () {
44+ test (std::ranges::begin, a);
45+ test (std::ranges::end, a);
46+ test (std::ranges::cbegin, a);
47+ test (std::ranges::cdata, a);
48+ test (std::ranges::cend, a);
49+ test (std::ranges::crbegin, a);
50+ test (std::ranges::crend, a);
51+ test (std::ranges::data, a);
52+ test (std::ranges::empty, a);
53+ test (std::ranges::rbegin, a);
54+ test (std::ranges::rend, a);
55+ test (std::ranges::size, a);
56+ test (std::ranges::ssize, a);
5757
5858#if TEST_STD_VER >= 26
59- // static_assert( test(std::views::reserve_hint, a) );
59+ // test(std::views::reserve_hint, a);
6060#endif
61+
62+ return true ;
63+ }
64+
65+ int main () {
66+ test ();
67+ static_assert (test ());
68+ }
0 commit comments