Skip to content

Commit ee0a6b5

Browse files
breaks correctly
1 parent a7235cb commit ee0a6b5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

libcxx/include/__tree

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,9 @@ public:
10341034
// fails here for move_alloc.pass.cpp
10351035

10361036
#if _LIBCPP_STD_VER >= 26
1037-
if (__libcpp_is_constant_evaluated()) {
1037+
if constexpr (
1038+
integral_constant<bool, is_copy_constructible<decltype(__value.first)>::value >()
1039+
) {
10381040
// static_assert(std::same_as_v<decltype(__value.first), double>);
10391041
// __emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
10401042

@@ -1272,13 +1274,13 @@ private:
12721274
error: no matching constructor for initialization of '__get_node_value_type_t<value_type>' (aka 'std::pair<const MoveOnly, MoveOnly>')
12731275
# | 1225 | __get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
12741276
*/
1275-
if (__libcpp_is_constant_evaluated()) {
1277+
if constexpr (integral_constant<bool, is_copy_constructible_v<_From> >()) {
12761278
// __move_from_value_type(__lhs, __rhs
12771279
// , integral_constant<bool, is_copy_constructible_v<_From> >()
12781280
// );
12791281

12801282
// TODO: narrow it to "_From.first"
1281-
if constexpr (integral_constant<bool, is_copy_constructible_v<_From> >()) {
1283+
// if constexpr (integral_constant<bool, is_copy_constructible_v<_From> >()) {
12821284
// we use copy, and not "move" as the constraint
12831285
// because we can NOT move from `const key_type`, which is how `value_type` is defined
12841286
// atleast for map
@@ -1301,15 +1303,15 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
13011303
__node_traits::construct(__na, std::addressof(__lhs), std::move(__tmp));
13021304

13031305

1304-
} else {
1306+
// } else {
13051307

13061308
// (void)__lhs;
13071309
// (void)__rhs;
1308-
static_assert(false, "Can not move from a pair<const T, U>");
1310+
// static_assert(false, "Can not move from a pair<const T, U>");
13091311
// TODO: how do I flag this code to NOT run at compile time?
13101312
// Using static_assert means this can't compile _at all_, regardless of whether this code is actually going to execute at compile time or not
13111313

1312-
}
1314+
// }
13131315

13141316

13151317

libcxx/test/std/containers/associative/map/map.cons/move_alloc.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ int main(int, char**) {
157157
assert(test());
158158
#if TEST_STD_VER >= 26
159159
// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
160-
// static_assert(test());
160+
static_assert(test());
161161
#endif
162162
return 0;
163163
}

libcxx/test/std/containers/associative/map/map.cons/move_assign.pass.cpp

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

26-
// TEST_CONSTEXPR_CXX26
26+
TEST_CONSTEXPR_CXX26
2727
bool test() {
2828
{
2929
typedef std::pair<MoveOnly, MoveOnly> V;
@@ -104,7 +104,7 @@ int main(int, char**) {
104104
assert(test());
105105
#if TEST_STD_VER >= 26
106106
// FIXME: Within __tree, it is not allowed to move from a `const MoveOnly` which prevents this from executing during constant evaluation
107-
// static_assert(test());
107+
static_assert(test());
108108
#endif
109109
return 0;
110110
}

0 commit comments

Comments
 (0)