Skip to content

Commit 8da6b53

Browse files
kind of fixed it, almost
1 parent a6c74cf commit 8da6b53

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

libcxx/include/__tree

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,14 +1023,41 @@ public:
10231023
return __emplace_hint_unique_key_args(__p, __x.first, std::forward<_Pp>(__x)).first;
10241024
}
10251025

1026+
template<
1027+
class _ValueT = _Tp,
1028+
__enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0
1029+
>
1030+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1031+
__sfinae_call_emplace_hint_unique(const_iterator __p, __get_node_value_type_t<_Tp>&& __value, false_type) {
1032+
// __emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1033+
// static_assert(false, "Can not emplace during constant evaluation if the key is `const MoveOnly` ");
1034+
(void)__p;
1035+
(void)__value;
1036+
}
1037+
1038+
template<
1039+
class _ValueT = _Tp,
1040+
__enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0
1041+
>
1042+
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
1043+
__sfinae_call_emplace_hint_unique(const_iterator __p, __get_node_value_type_t<_Tp>&& __value, true_type) {
1044+
__emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1045+
}
1046+
1047+
10261048
template <class _ValueT = _Tp, __enable_if_t<__is_tree_value_type<_ValueT>::value, int> = 0>
10271049
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 void
10281050
__insert_unique_from_orphaned_node(const_iterator __p, __get_node_value_type_t<_Tp>&& __value) {
10291051
// fails here for move_alloc.pass.cpp
10301052

10311053
#if _LIBCPP_STD_VER >= 26
10321054
if (__libcpp_is_constant_evaluated()) {
1033-
__emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1055+
// static_assert(std::same_as_v<decltype(__value.first), double>);
1056+
// __emplace_hint_unique(__p, std::move(__value.first), std::move(__value.second));
1057+
1058+
__sfinae_call_emplace_hint_unique(__p, std::move(__value),
1059+
integral_constant<bool, is_copy_constructible<decltype(__value.first)>::value >()
1060+
);
10341061
} else
10351062
#endif
10361063
{

0 commit comments

Comments
 (0)