@@ -1027,14 +1027,12 @@ public:
10271027 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
10281028 __insert_unique_from_orphaned_node (const_iterator __p, __get_node_value_type_t <_Tp>&& __value) {
10291029 // fails here for move_alloc.pass.cpp
1030- if (
1031- (
1032- _LIBCPP_STD_VER >= 26
1033- )
1034- &&
1035- __libcpp_is_constant_evaluated ()) {
1030+
1031+ #if _LIBCPP_STD_VER >= 26
1032+ if (__libcpp_is_constant_evaluated ()) {
10361033 __emplace_hint_unique (__p, std::move (__value.first ), std::move (__value.second ));
10371034 } else
1035+ #endif
10381036 {
10391037 __emplace_hint_unique (__p, const_cast <key_type&&>(__value.first ), std::move (__value.second ));
10401038 }
@@ -1212,6 +1210,35 @@ private:
12121210 }
12131211 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
12141212
1213+
1214+ // todo; mark consteval?
1215+ #ifdef FAKE_VINAY
1216+
1217+ template <class _From , class _ValueT = _Tp,
1218+ __enable_if_t <__is_tree_value_type<_ValueT>::value, int > = 0
1219+ , __enable_if_t < ! is_copy_constructible_v< typename _From::first_type >, int > = 0
1220+ >
1221+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1222+ __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , false_type*/ ) _NOEXCEPT {
1223+ (void )__lhs;
1224+ (void )__rhs;
1225+ static_assert (false , " Can not move from a pair<const T, T>" );
1226+ }
1227+
1228+ template <class _From , class _ValueT = _Tp,
1229+ __enable_if_t <__is_tree_value_type<_ValueT>::value, int > = 0
1230+
1231+ // Check if first type can be copy constructed
1232+ , __enable_if_t < is_copy_constructible_v< typename _From::first_type >, int > = 0
1233+ >
1234+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
1235+ __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , true_type*/ ) _NOEXCEPT {
1236+
1237+ }
1238+ #endif
1239+
1240+
1241+
12151242 template <class _From , class _ValueT = _Tp, __enable_if_t <__is_tree_value_type<_ValueT>::value, int > = 0 >
12161243 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
12171244 __assign_value ( __get_node_value_type_t <value_type>& __lhs, _From&& __rhs) {
@@ -1226,16 +1253,29 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
12261253# | 1225 | __get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
12271254 */
12281255 if (__libcpp_is_constant_evaluated ()) {
1256+ // __move_from_value_type(__lhs, __rhs
1257+ // , integral_constant<bool, is_copy_constructible_v<_From> >()
1258+ // );
1259+
12291260 using __node_value_type = __get_node_value_type_t <value_type>;
12301261 __get_node_value_type_t <value_type> __tmp (__rhs.first , __rhs.second );
1262+ // __get_node_value_type_t<value_type> __tmp(__rhs);
1263+
12311264 // const_cast is not allowed at constexpr time.
1232- // we get around this by deleting and creating a new node value
1265+ // we get around this by deleting __lhs and creating a new node in-place
1266+ // to avoid const_cast -ing __lhs.first
1267+
12331268 // note: this does not work for `const MoveOnly` keys at constexpr time
12341269
12351270 // __lhs.~__node_value_type();
12361271 __node_allocator& __na = __node_alloc ();
12371272 __node_traits::destroy (__na, std::addressof (__lhs));
12381273 __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1274+
1275+
1276+
1277+
1278+
12391279 } else
12401280 #endif
12411281 {
@@ -1915,14 +1955,13 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
19151955 // for container_test_types.h
19161956 // but I don't know how to placement new to avoid instantiation
19171957
1918- } else {
1958+ } else
19191959 #endif
1920-
1960+ {
19211961 __node_traits::construct (__na, std::addressof (__h->__value_ ), std::forward<_Args>(__args)...);
1922-
1923-
1924- #if _LIBCPP_STD_VER >= 26
19251962 }
1963+ #if _LIBCPP_STD_VER >= 26
1964+
19261965 #endif
19271966
19281967
0 commit comments