@@ -592,6 +592,7 @@ public:
592592 template <class ... _Args>
593593 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node (_Args&&... __args)
594594 : __value_(std::forward<_Args>(__args)...) {}
595+ // _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree_node() = default;
595596 ~__tree_node () = delete ;
596597 __tree_node (__tree_node const &) = delete ;
597598 __tree_node& operator =(__tree_node const &) = delete ;
@@ -1899,14 +1900,52 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
18991900 __node_holder __h (__node_traits::allocate (__na, 1 ), _Dp (__na));
19001901
19011902 #if _LIBCPP_STD_VER >= 26
1902- #else
1903- #endif
1903+ if (__libcpp_is_constant_evaluated ()) {
19041904
19051905 // here.... for same_as failure
1906- // __node_traits::construct(__na, std::addressof(*__h), std::forward<_Args>(__args)...);
1906+ __node_traits::construct (__na, std::addressof (*__h), std::forward<_Args>(__args)...);
19071907 // note: construction of subobject of object outside its lifetime is not allowed in a constant expression
1908+
1909+ // we do need to
1910+ // avoid instantiating anything other than allocator::construct(Args...)
1911+ // for container_test_types.h
1912+ // but I don't know how else to placement new to avoid instantiation
1913+
1914+ // typename __node_holder::pointer
1915+ // __h_tree_node =
1916+ // // std::__static_fancy_pointer_cast<typename __node_holder::pointer>
1917+ // (
1918+ // __node_traits::allocate(__na, sizeof(typename __node_holder::element_type))
1919+ // )
1920+ // ;
1921+ // (void)__h_tree_node;
1922+
1923+ // using __elem = __node_holder::element_type;
1924+ // ::new (
1925+ // std::__static_fancy_pointer_cast<void*>(
1926+ // std::__static_fancy_pointer_cast<typename __node_holder::pointer>(
1927+ // __h_tree_node
1928+ // )
1929+ // )
1930+ // ) __elem (
1931+ // std::forward<_Args>(__args)...
1932+ // );
1933+
1934+ // __node_holder::element_type ;
1935+
1936+ // __node_traits::construct(__na, std::addressof(__h->__value_), std::forward<_Args>(__args)...);
1937+
1938+ } else {
1939+ #endif
1940+
19081941 __node_traits::construct (__na, std::addressof (__h->__value_ ), std::forward<_Args>(__args)...);
19091942
1943+
1944+ #if _LIBCPP_STD_VER >= 26
1945+ }
1946+ #endif
1947+
1948+
19101949 __h.get_deleter ().__value_constructed = true ;
19111950 return __h;
19121951}
0 commit comments