@@ -1218,67 +1218,45 @@ private:
12181218 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_assign_alloc (__tree&, false_type) _NOEXCEPT {}
12191219
12201220
1221- // todo; mark consteval?
1222- // #ifdef FAKE_VINAY
1221+ // todo; remove
1222+ #ifdef FAKE_VINAY
12231223
12241224 template <class _From , class _ValueT = _Tp,
12251225 __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
12261226
1227- // , typename = std::enable_if_t<
1228- // !std::is_copy_constructible_v<
1229- // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1230- // >
1231- // >
1227+ , typename = std::enable_if_t <
1228+ !std::is_copy_constructible_v<
1229+ std::remove_cvref_t <decltype (std::declval<_From>().first)>
1230+ >
1231+ >
12321232 >
1233- requires (!std::is_copy_constructible_v<
1234- std::remove_cvref_t <decltype (std::declval<_From>().first)>
1235- >)
1233+ // requires (!std::is_copy_constructible_v<
1234+ // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1235+ // >)
12361236 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
12371237 __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , false_type*/ ) _NOEXCEPT {
1238- (void )__lhs;
1239- (void )__rhs;
1240- // static_assert(false, "Can not move from a pair<const T, U>");
1241- // TODO: how do I flag this code to NOT run at compile time?
1242- // 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
12431238 }
12441239
12451240 template <class _From , class _ValueT = _Tp,
12461241 __enable_if_t <__is_tree_value_type_v<_ValueT>, int > = 0
12471242
12481243 // Check if first type can be copy constructed
12491244
1250- // , typename = std::enable_if_t<
1251- // std::is_copy_constructible_v<
1252- // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1253- // >
1254- // >
1245+ , typename = std::enable_if_t <
1246+ std::is_copy_constructible_v<
1247+ std::remove_cvref_t <decltype (std::declval<_From>().first)>
1248+ >
1249+ >
12551250 >
1256- requires ( std::is_copy_constructible_v<
1257- std::remove_cvref_t <decltype (std::declval<_From>().first)>
1258- >)
1251+ // requires ( std::is_copy_constructible_v<
1252+ // std::remove_cvref_t<decltype(std::declval<_From>().first)>
1253+ // >)
12591254 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void __move_from_value_type (
12601255 __get_node_value_type_t <value_type>& __lhs, _From&& __rhs/* , true_type*/ ) _NOEXCEPT {
12611256
12621257
1263- // const_cast is not allowed at constexpr time.
1264- // we get around this by deleting __lhs and creating a new node in-place
1265- // to avoid const_cast -ing __lhs.first
1266-
1267- // note: this does not work for `const MoveOnly` keys at constexpr time
1268-
1269-
1270- __node_allocator& __na = __node_alloc ();
1271- __node_traits::destroy (__na, std::addressof (__lhs));
1272-
1273- // __get_node_value_type_t<value_type> __tmp(__rhs);
1274- using __node_value_type = __get_node_value_type_t <value_type>;
1275- __node_value_type __tmp (__rhs.first , __rhs.second );
1276- __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1277-
1278-
1279-
12801258 }
1281- // #endif
1259+ #endif
12821260
12831261
12841262
@@ -1295,9 +1273,37 @@ error: no matching constructor for initialization of '__get_node_value_type_t<va
12951273# | 1225 | __get_node_value_type_t<value_type> __tmp(__rhs.first, __rhs.second);
12961274 */
12971275 if (__libcpp_is_constant_evaluated ()) {
1298- __move_from_value_type (__lhs, __rhs
1276+ // __move_from_value_type(__lhs, __rhs
12991277 // , integral_constant<bool, is_copy_constructible_v<_From> >()
1300- );
1278+ // );
1279+
1280+ if constexpr (integral_constant<bool , is_copy_constructible_v<_From> >()) {
1281+
1282+ // const_cast is not allowed at constexpr time.
1283+ // we get around this by deleting __lhs and creating a new node in-place
1284+ // to avoid const_cast -ing __lhs.first
1285+
1286+ // note: this does not work for `const MoveOnly` keys at constexpr time
1287+
1288+
1289+ __node_allocator& __na = __node_alloc ();
1290+ __node_traits::destroy (__na, std::addressof (__lhs));
1291+
1292+ // __get_node_value_type_t<value_type> __tmp(__rhs);
1293+ using __node_value_type = __get_node_value_type_t <value_type>;
1294+ __node_value_type __tmp (__rhs.first , __rhs.second );
1295+ __node_traits::construct (__na, std::addressof (__lhs), std::move (__tmp));
1296+
1297+
1298+ } else {
1299+
1300+ // (void)__lhs;
1301+ // (void)__rhs;
1302+ // static_assert(false, "Can not move from a pair<const T, U>");
1303+ // TODO: how do I flag this code to NOT run at compile time?
1304+ // 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
1305+
1306+ }
13011307
13021308
13031309
0 commit comments