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 __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 __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 __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 __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 __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 __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 __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,23 +2474,26 @@ 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) @@ -2483,13 +2502,13 @@ return *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) @@ -2503,7 +2522,7 @@ #ifndef _LIBCPP_HAS_NO_VARIADICS template - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __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/unique.ptr.runtime.ctor/constinit.pass.cpp =================================================================== --- /dev/null +++ test/std/utilities/memory/unique.ptr/unique.ptr.runtime/unique.ptr.runtime.ctor/constinit.pass.cpp @@ -0,0 +1,23 @@ +//===----------------------------------------------------------------------===// +// +// 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, c++11 + +#include +#include + +#ifndef _LIBCPP_SAFE_STATIC +#define _LIBCPP_SAFE_STATIC +#endif + +_LIBCPP_SAFE_STATIC static std::unique_ptr a; + +int main() { + assert(a == nullptr); +}