Index: include/memory =================================================================== --- include/memory +++ include/memory @@ -2096,24 +2096,28 @@ typedef const typename remove_reference<_T1>::type& _T1_const_reference; typedef const typename remove_reference<_T2>::type& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp() : __first_(), __second_() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T1_param __t1) : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T2_param __t2) : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value && is_nothrow_copy_constructible<_T2>::value) : __first_(__p.first()), __second_(__p.second()) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value && is_nothrow_copy_assignable<_T2>::value) @@ -2123,14 +2127,14 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : __first_(_VSTD::forward<_T1>(__p.first())), __second_(_VSTD::forward<_T2>(__p.second())) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value && is_nothrow_move_assignable<_T2>::value) @@ -2145,7 +2149,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args, @@ -2189,23 +2193,27 @@ typedef const _T1& _T1_const_reference; typedef const typename remove_reference<_T2>::type& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp() : __second_() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T1_param __t1) : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T2_param __t2) : __second_(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {} #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value && is_nothrow_copy_constructible<_T2>::value) : _T1(__p.first()), __second_(__p.second()) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value && is_nothrow_copy_assignable<_T2>::value) @@ -2215,13 +2223,13 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : _T1(_VSTD::move(__p.first())), __second_(_VSTD::forward<_T2>(__p.second())) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value && is_nothrow_move_assignable<_T2>::value) @@ -2236,7 +2244,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args, @@ -2279,25 +2287,29 @@ typedef const typename remove_reference<_T1>::type& _T1_const_reference; typedef const _T2& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp() : __first_() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T1_param __t1) : __first_(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T2_param __t2) : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {} #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value && is_nothrow_copy_constructible<_T2>::value) : _T2(__p.second()), __first_(__p.first()) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value && is_nothrow_copy_assignable<_T2>::value) @@ -2307,13 +2319,13 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : _T2(_VSTD::forward<_T2>(__p.second())), __first_(_VSTD::move(__p.first())) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value && is_nothrow_move_assignable<_T2>::value) @@ -2328,7 +2340,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args, @@ -2371,23 +2383,27 @@ typedef const _T1& _T1_const_reference; typedef const _T2& _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T1_param __t1) : _T1(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __libcpp_compressed_pair_imp(_T2_param __t2) : _T2(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2) : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {} #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value && is_nothrow_copy_constructible<_T2>::value) : _T1(__p.first()), _T2(__p.second()) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp& operator=(const __libcpp_compressed_pair_imp& __p) _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value && is_nothrow_copy_assignable<_T2>::value) @@ -2397,13 +2413,13 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : _T1(_VSTD::move(__p.first())), _T2(_VSTD::move(__p.second())) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __libcpp_compressed_pair_imp& operator=(__libcpp_compressed_pair_imp&& __p) _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value && is_nothrow_move_assignable<_T2>::value) @@ -2418,7 +2434,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_compressed_pair_imp(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args, @@ -2458,44 +2474,45 @@ typedef typename base::_T1_const_reference _T1_const_reference; typedef typename base::_T2_const_reference _T2_const_reference; - _LIBCPP_INLINE_VISIBILITY __compressed_pair() {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair() {} + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __compressed_pair(_T1_param __t1) : base(_VSTD::forward<_T1_param>(__t1)) {} - _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit __compressed_pair(_T2_param __t2) : base(_VSTD::forward<_T2_param>(__t2)) {} - _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2) + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + __compressed_pair(_T1_param __t1, _T2_param __t2) : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {} #if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair(const __compressed_pair& __p) _NOEXCEPT_(is_nothrow_copy_constructible<_T1>::value && is_nothrow_copy_constructible<_T2>::value) : base(__p) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair& operator=(const __compressed_pair& __p) _NOEXCEPT_(is_nothrow_copy_assignable<_T1>::value && is_nothrow_copy_assignable<_T2>::value) { - base::operator=(__p); - return *this; + return base::operator=(__p), *this; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair(__compressed_pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value && is_nothrow_move_constructible<_T2>::value) : base(_VSTD::move(__p)) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __compressed_pair& operator=(__compressed_pair&& __p) _NOEXCEPT_(is_nothrow_move_assignable<_T1>::value && is_nothrow_move_assignable<_T2>::value) { - base::operator=(_VSTD::move(__p)); - return *this; + return base::operator=(_VSTD::move(__p)), *this; } #endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) @@ -2503,7 +2520,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args), Index: test/std/utilities/memory/unique.ptr/unique.ptr.runtime/constinit.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/constinit.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +#include +#include + +#ifndef _LIBCPP_SAFE_STATIC +#define _LIBCPP_SAFE_STATIC +#endif + +// This is basically std::default delete, except that it is not empty such that +// we test a different code path in the implementation +template struct nonempty_delete { + uint32_t sentinel; + inline constexpr nonempty_delete() noexcept : sentinel(0xDEADBEEF) {} + template + constexpr inline nonempty_delete( + const nonempty_delete &, + typename std::enable_if::value>::type * = + 0) noexcept : sentinel(0xBAADF00D) {} + inline void operator()(Tp *ptr) const noexcept { + assert(sentinel == 0xDEADBEEF || sentinel == 0xBAADF00D); + delete[] ptr; + } +}; + +extern std::unique_ptr a; +extern std::unique_ptr b; +extern std::unique_ptr> c; +extern std::unique_ptr> d; +void *tramplea = std::memset(&a, 0xab, sizeof(a)); +void *trampleb = std::memset(&b, 0xab, sizeof(b)); +void *tramplec = std::memset(&a, 0xab, sizeof(c)); +void *trampled = std::memset(&b, 0xab, sizeof(d)); +_LIBCPP_SAFE_STATIC std::unique_ptr a; +_LIBCPP_SAFE_STATIC std::unique_ptr b(nullptr); +_LIBCPP_SAFE_STATIC std::unique_ptr> c; +_LIBCPP_SAFE_STATIC std::unique_ptr> d(nullptr); + +int main() { + // Check that the initialization of 'a' was performed before the + // initialization of 'tramplea'. + for (size_t n = 0; n != sizeof(a); ++n) + assert(reinterpret_cast(tramplea)[n] == 0xab); + // Check that the initialization of 'b' was performed before the + // initialization of 'trampleb'. + for (size_t n = 0; n != sizeof(b); ++n) + assert(reinterpret_cast(trampleb)[n] == 0xab); + // Check that the initialization of 'c' was performed before the + // initialization of 'tramplec'. + for (size_t n = 0; n != sizeof(c); ++n) + assert(reinterpret_cast(tramplec)[n] == 0xab); + // Check that the initialization of 'd' was performed before the + // initialization of 'trampled'. + for (size_t n = 0; n != sizeof(d); ++n) + assert(reinterpret_cast(trampled)[n] == 0xab); + // Put a unique_ptr object back so that the global dtor is valid. + new (&a) std::unique_ptr; + new (&b) std::unique_ptr; + new (&c) std::unique_ptr>; + new (&d) std::unique_ptr>; +} Index: test/std/utilities/memory/unique.ptr/unique.ptr.single/constinit.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/memory/unique.ptr/unique.ptr.single/constinit.pass.cpp @@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03 + +#include +#include + +#ifndef _LIBCPP_SAFE_STATIC +#define _LIBCPP_SAFE_STATIC +#endif + +// This is basically std::default delete, except that it is not empty such that +// we test a different code path in the implementation +template struct nonempty_delete { + uint32_t sentinel; + inline constexpr nonempty_delete() noexcept : sentinel(0xDEADBEEF) {} + template + constexpr inline nonempty_delete( + const nonempty_delete &, + typename std::enable_if::value>::type * = + 0) noexcept : sentinel(0xBAADF00D) {} + inline void operator()(Tp *ptr) const noexcept { + assert(sentinel == 0xDEADBEEF || sentinel == 0xBAADF00D); + delete ptr; + } +}; + +extern std::unique_ptr a; +extern std::unique_ptr b; +extern std::unique_ptr> c; +extern std::unique_ptr> d; +void *tramplea = std::memset(&a, 0xab, sizeof(a)); +void *trampleb = std::memset(&b, 0xab, sizeof(b)); +void *tramplec = std::memset(&a, 0xab, sizeof(c)); +void *trampled = std::memset(&b, 0xab, sizeof(d)); +_LIBCPP_SAFE_STATIC std::unique_ptr a; +_LIBCPP_SAFE_STATIC std::unique_ptr b(nullptr); +_LIBCPP_SAFE_STATIC std::unique_ptr> c; +_LIBCPP_SAFE_STATIC std::unique_ptr> d(nullptr); + +int main() { + // Check that the initialization of 'a' was performed before the + // initialization of 'tramplea'. + for (size_t n = 0; n != sizeof(a); ++n) + assert(reinterpret_cast(tramplea)[n] == 0xab); + // Check that the initialization of 'b' was performed before the + // initialization of 'trampleb'. + for (size_t n = 0; n != sizeof(b); ++n) + assert(reinterpret_cast(trampleb)[n] == 0xab); + // Check that the initialization of 'c' was performed before the + // initialization of 'tramplec'. + for (size_t n = 0; n != sizeof(c); ++n) + assert(reinterpret_cast(tramplec)[n] == 0xab); + // Check that the initialization of 'd' was performed before the + // initialization of 'trampled'. + for (size_t n = 0; n != sizeof(d); ++n) + assert(reinterpret_cast(trampled)[n] == 0xab); + // Put a unique_ptr object back so that the global dtor is valid. + new (&a) std::unique_ptr; + new (&b) std::unique_ptr; + new (&c) std::unique_ptr>; + new (&d) std::unique_ptr>; +}