Skip to content

Commit f57f746

Browse files
committed
op
1 parent 417ed1a commit f57f746

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

libcxx/test/std/containers/container.adaptors/flat.multiset/op_compare.pass.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "test_container_comparisons.h"
3232

3333
template <class KeyContainer>
34-
void test_one() {
34+
constexpr void test_one() {
3535
using Key = typename KeyContainer::value_type;
3636

3737
{
@@ -64,9 +64,12 @@ void test_one() {
6464
}
6565
}
6666

67-
void test() {
67+
constexpr bool test() {
6868
test_one<std::vector<int>>();
69-
test_one<std::deque<int>>();
69+
#ifndef __cpp_lib_constexpr_deque
70+
if (!TEST_IS_CONSTANT_EVALUATED)
71+
#endif
72+
test_one<std::deque<int>>();
7073
test_one<MinSequenceContainer<int>>();
7174
test_one<std::vector<int, min_allocator<int>>>();
7275

@@ -81,7 +84,7 @@ void test() {
8184
{
8285
// Comparisons use value_type's native operators, not the comparator
8386
struct StrongComp {
84-
bool operator()(double a, double b) const { return std::strong_order(a, b) < 0; }
87+
constexpr bool operator()(double a, double b) const { return std::strong_order(a, b) < 0; }
8588
};
8689
using C = std::flat_multiset<double, StrongComp>;
8790
C s1 = {1};
@@ -96,10 +99,15 @@ void test() {
9699
assert(s1 != s2);
97100
assert((s1 <=> s2) == std::partial_ordering::unordered);
98101
}
102+
103+
return true;
99104
}
100105

101106
int main(int, char**) {
102107
test();
108+
#if TEST_STD_VER >= 26
109+
static_assert(test());
110+
#endif
103111

104112
return 0;
105113
}

0 commit comments

Comments
 (0)