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