diff --git a/libcxx/include/list b/libcxx/include/list --- a/libcxx/include/list +++ b/libcxx/include/list @@ -270,11 +270,14 @@ struct __list_node : public __list_node_base<_Tp, _VoidPtr> { - _Tp __value_; + union { _Tp __value_; }; typedef __list_node_base<_Tp, _VoidPtr> __base; typedef typename __base::__link_pointer __link_pointer; + _LIBCPP_INLINE_VISIBILITY + __list_node() { } + _LIBCPP_INLINE_VISIBILITY __link_pointer __as_link() { return static_cast<__link_pointer>(__base::__self()); @@ -1113,6 +1116,7 @@ _LIBCPP_INLINE_VISIBILITY __hold_pointer __allocate_node(__node_allocator& __na) { __node_pointer __p = __node_alloc_traits::allocate(__na, 1); + ::new ((void*)_VSTD::addressof(*__p)) __node(); __p->__prev_ = nullptr; return __hold_pointer(__p, __node_destructor(__na, 1)); }