@@ -543,7 +543,11 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
543543 }
544544
545545 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 static __container_value_type* __get_ptr (__node_value_type& __n) {
546- return std::addressof (__n.__get_value ());
546+ // __n's lifetime has not begun, so calling __get_value is wrong
547+
548+ // return std::addressof(__n.__get_value());
549+
550+ return __node_value_type::__get_address_of_value (__n);
547551 }
548552
549553 _LIBCPP_HIDE_FROM_ABI static pair<key_type&&, mapped_type&&> __move (__node_value_type& __v) { return __v.__move (); }
@@ -658,6 +662,7 @@ public:
658662 __node_value_type __value_;
659663
660664 _LIBCPP_HIDE_FROM_ABI _Tp& __get_value () { return __value_; }
665+ // _LIBCPP_HIDE_FROM_ABI static _Tp& __get_value_static(__tree_node * foo) { return (foo->__value_); }
661666
662667 ~__tree_node () = delete ;
663668 __tree_node (__tree_node const &) = delete ;
@@ -1816,8 +1821,9 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&&... __args) {
18161821
18171822template <class _Tp , class _Compare , class _Allocator >
18181823template <class ... _Args>
1824+ _LIBCPP_CONSTEXPR_SINCE_CXX26
18191825pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool >
1820- _LIBCPP_CONSTEXPR_SINCE_CXX26 __tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) {
1826+ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_impl(_Args&&... __args) {
18211827 __node_holder __h = __construct_node (std::forward<_Args>(__args)...);
18221828 __parent_pointer __parent;
18231829 __node_base_pointer& __child = __find_equal (__parent, __h->__value_ );
0 commit comments