Skip to content

Commit 7ce7dcd

Browse files
Fix set/ final tests
1 parent df77e29 commit 7ce7dcd

19 files changed

+77
-65
lines changed

libcxx/include/__node_handle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ template <class _NodeType, class _Derived>
172172
struct __set_node_handle_specifics {
173173
typedef typename _NodeType::__node_value_type value_type;
174174

175-
_LIBCPP_HIDE_FROM_ABI value_type& value() const { return static_cast<_Derived const*>(this)->__ptr_->__get_value(); }
175+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 value_type& value() const {
176+
return static_cast<_Derived const*>(this)->__ptr_->__get_value();
177+
}
176178
};
177179

178180
template <class _NodeType, class _Derived>

libcxx/test/std/containers/associative/set/contains.pass.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
#include <cassert>
1212
#include <set>
1313

14+
#include "test_macros.h"
15+
1416
// <set>
1517

1618
// constexpr bool contains(const key_type& x) const; // constexpr since C++26
1719

1820
template <typename T, typename V, typename B, typename... Vals>
19-
void test(B bad, Vals... args) {
21+
TEST_CONSTEXPR_CXX26 void test(B bad, Vals... args) {
2022
T set;
2123
V vals[] = {args...};
2224

@@ -39,7 +41,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
3941
test<std::set<int>, int>(14, 10, 11, 12, 13);
4042
test<std::set<char>, char>('e', 'a', 'b', 'c', 'd');
4143
}
42-
{
44+
if (!TEST_IS_CONSTANT_EVALUATED) {
4345
test<std::multiset<int>, int>(14, 10, 11, 12, 13);
4446
test<std::multiset<char>, char>('e', 'a', 'b', 'c', 'd');
4547
}

libcxx/test/std/containers/associative/set/contains_transparent.pass.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,22 @@
1818
#include <set>
1919
#include <utility>
2020

21+
#include "test_macros.h"
22+
2123
struct Comp {
2224
using is_transparent = void;
2325

24-
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
26+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
27+
return lhs < rhs;
28+
}
2529

26-
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
30+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
2731

28-
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
32+
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
2933
};
3034

3135
template <typename Container>
32-
void test() {
36+
TEST_CONSTEXPR_CXX26 void test() {
3337
Container s{{2, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 2}};
3438

3539
assert(s.contains(1));
@@ -38,7 +42,8 @@ void test() {
3842

3943
TEST_CONSTEXPR_CXX26 bool test() {
4044
test<std::set<std::pair<int, int>, Comp> >();
41-
test<std::multiset<std::pair<int, int>, Comp> >();
45+
if (!TEST_IS_CONSTANT_EVALUATED)
46+
test<std::multiset<std::pair<int, int>, Comp> >();
4247

4348
return true;
4449
}

libcxx/test/std/containers/associative/set/count_transparent.pass.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,18 @@
1919
#include <set>
2020
#include <utility>
2121

22+
#include "test_macros.h"
23+
2224
struct Comp {
2325
using is_transparent = void;
2426

25-
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
27+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
28+
return lhs < rhs;
29+
}
2630

27-
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
31+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
2832

29-
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
33+
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
3034
};
3135

3236
TEST_CONSTEXPR_CXX26 bool test() {

libcxx/test/std/containers/associative/set/emplace.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "min_allocator.h"
2525

2626
TEST_CONSTEXPR_CXX26 bool test() {
27-
{
27+
if (!TEST_IS_CONSTANT_EVALUATED) {
2828
typedef std::set<DefaultOnly> M;
2929
typedef std::pair<M::iterator, bool> R;
3030
M m;
@@ -43,7 +43,8 @@ TEST_CONSTEXPR_CXX26 bool test() {
4343
assert(*m.begin() == DefaultOnly());
4444
assert(DefaultOnly::count == 1);
4545
}
46-
assert(DefaultOnly::count == 0);
46+
if (!TEST_IS_CONSTANT_EVALUATED)
47+
assert(DefaultOnly::count == 0);
4748
{
4849
typedef std::set<Emplaceable> M;
4950
typedef std::pair<M::iterator, bool> R;

libcxx/test/std/containers/associative/set/emplace_hint.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "min_allocator.h"
2525

2626
TEST_CONSTEXPR_CXX26 bool test() {
27-
{
27+
if (!TEST_IS_CONSTANT_EVALUATED) {
2828
typedef std::set<DefaultOnly> M;
2929
typedef M::iterator R;
3030
M m;
@@ -41,7 +41,8 @@ TEST_CONSTEXPR_CXX26 bool test() {
4141
assert(*m.begin() == DefaultOnly());
4242
assert(DefaultOnly::count == 1);
4343
}
44-
assert(DefaultOnly::count == 0);
44+
if (!TEST_IS_CONSTANT_EVALUATED)
45+
assert(DefaultOnly::count == 0);
4546
{
4647
typedef std::set<Emplaceable> M;
4748
typedef M::iterator R;

libcxx/test/std/containers/associative/set/equal_range_transparent.pass.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,18 @@
2323
#include <set>
2424
#include <utility>
2525

26+
#include "test_macros.h"
27+
2628
struct Comp {
2729
using is_transparent = void;
2830

29-
bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const { return lhs < rhs; }
31+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, const std::pair<int, int>& rhs) const {
32+
return lhs < rhs;
33+
}
3034

31-
bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
35+
TEST_CONSTEXPR_CXX26 bool operator()(const std::pair<int, int>& lhs, int rhs) const { return lhs.first < rhs; }
3236

33-
bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
37+
TEST_CONSTEXPR_CXX26 bool operator()(int lhs, const std::pair<int, int>& rhs) const { return lhs < rhs.first; }
3438
};
3539

3640
TEST_CONSTEXPR_CXX26 bool test() {

libcxx/test/std/containers/associative/set/erase_iter.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020

2121
struct TemplateConstructor {
2222
template <typename T>
23-
TemplateConstructor(const T&) {}
23+
TEST_CONSTEXPR_CXX26 TemplateConstructor(const T&) {}
2424
};
2525

26-
bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
26+
TEST_CONSTEXPR_CXX26 bool operator<(const TemplateConstructor&, const TemplateConstructor&) { return false; }
2727

2828
TEST_CONSTEXPR_CXX26 bool test() {
2929
{

libcxx/test/std/containers/associative/set/extract_iterator.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "Counter.h"
2121

2222
template <class Container>
23-
void test(Container& c) {
23+
TEST_CONSTEXPR_CXX26 void test(Container& c) {
2424
std::size_t sz = c.size();
2525

2626
for (auto first = c.cbegin(); first != c.cend();) {
@@ -42,7 +42,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
4242
test(m);
4343
}
4444

45-
{
45+
if (!TEST_IS_CONSTANT_EVALUATED) {
4646
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
4747
assert(Counter_base::gConstructed == 6);
4848
test(m);

libcxx/test/std/containers/associative/set/extract_key.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "Counter.h"
2121

2222
template <class Container, class KeyTypeIter>
23-
void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
23+
TEST_CONSTEXPR_CXX26 void test(Container& c, KeyTypeIter first, KeyTypeIter last) {
2424
std::size_t sz = c.size();
2525
assert((std::size_t)std::distance(first, last) == sz);
2626

@@ -48,7 +48,7 @@ TEST_CONSTEXPR_CXX26 bool test() {
4848
test(m, std::begin(keys), std::end(keys));
4949
}
5050

51-
{
51+
if (!TEST_IS_CONSTANT_EVALUATED) {
5252
std::set<Counter<int>> m = {1, 2, 3, 4, 5, 6};
5353
{
5454
Counter<int> keys[] = {1, 2, 3, 4, 5, 6};

0 commit comments

Comments
 (0)