Skip to content

Commit ef90a64

Browse files
copy_assign.pass.cpp
1 parent ca06b8a commit ef90a64

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

libcxx/include/__tree

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,23 +1217,22 @@ private:
12171217
__assign_value( __get_node_value_type_t<value_type>& __lhs, _From&& __rhs) {
12181218
using __key_type = __remove_const_t<typename value_type::first_type>;
12191219

1220-
if (
1221-
(
1222-
_LIBCPP_STD_VER >= 26
1223-
)
1224-
&&
1225-
__libcpp_is_constant_evaluated()) {
1220+
1221+
#if _LIBCPP_STD_VER >= 26
1222+
if (__libcpp_is_constant_evaluated()) {
12261223
using __node_value_type = __get_node_value_type_t<value_type>;
12271224
__get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
12281225
// const_cast is not allowed at constexpr time.
12291226
// we get around this by deleting and creating a new node value
12301227
// note: this does not work for `const MoveOnly` keys at constexpr time
1231-
__lhs.~__node_value_type();
1228+
1229+
// __lhs.~__node_value_type();
12321230
__node_allocator& __na = __node_alloc();
12331231
__node_traits::destroy(__na, std::addressof(__lhs));
1234-
// Fails here for `std/containers/associative/map/map.cons/move_assign.pass.cpp`
12351232
__node_traits::construct(__na, std::addressof(__lhs), std::move(__tmp));
1236-
} else {
1233+
} else
1234+
#endif
1235+
{
12371236
// This is technically UB, since the object was constructed as `const`.
12381237
// Clang doesn't optimize on this currently though.
12391238
const_cast<__key_type&>(__lhs.first) = const_cast<__copy_cvref_t<_From, __key_type>&&>(__rhs.first);

0 commit comments

Comments
 (0)