diff --git a/libcxx/include/__debug b/libcxx/include/__debug --- a/libcxx/include/__debug +++ b/libcxx/include/__debug @@ -221,7 +221,7 @@ template _LIBCPP_INLINE_VISIBILITY static __c_node* __create_C_node(void *__mem, void *__c, __c_node *__next) { - return ::new(__mem) _C_node<_Cont>(__c, __next); + return ::new (__mem) _C_node<_Cont>(__c, __next); } template diff --git a/libcxx/include/__functional_03 b/libcxx/include/__functional_03 --- a/libcxx/include/__functional_03 +++ b/libcxx/include/__functional_03 @@ -126,7 +126,7 @@ _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } @@ -134,7 +134,7 @@ void __func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const { - ::new (__p) __func(__f_.first(), __f_.second()); + ::new ((void*)__p) __func(__f_.first(), __f_.second()); } template @@ -212,7 +212,7 @@ _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } @@ -220,7 +220,7 @@ void __func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const { - ::new (__p) __func(__f_.first(), __f_.second()); + ::new ((void*)__p) __func(__f_.first(), __f_.second()); } template @@ -298,7 +298,7 @@ _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } @@ -306,7 +306,7 @@ void __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const { - ::new (__p) __func(__f_.first(), __f_.second()); + ::new ((void*)__p) __func(__f_.first(), __f_.second()); } template @@ -384,7 +384,7 @@ _Ap __a(__f_.second()); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) __func(__f_.first(), _Alloc(__a)); + ::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a)); return __hold.release(); } @@ -392,7 +392,7 @@ void __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const { - ::new (__p) __func(__f_.first(), __f_.second()); + ::new ((void*)__p) __func(__f_.first(), __f_.second()); } template @@ -554,7 +554,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f); + ::new ((void*)__f_) _FF(__f); } else { @@ -562,7 +562,7 @@ _Ap __a; typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); + ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } @@ -581,7 +581,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f, __a0); + ::new ((void*)__f_) _FF(__f, __a0); } else { @@ -589,7 +589,7 @@ _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, _Alloc(__a)); + ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } @@ -834,7 +834,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f); + ::new ((void*)__f_) _FF(__f); } else { @@ -842,7 +842,7 @@ _Ap __a; typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); + ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } @@ -861,7 +861,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f, __a0); + ::new ((void*)__f_) _FF(__f, __a0); } else { @@ -869,7 +869,7 @@ _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, _Alloc(__a)); + ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } @@ -1114,7 +1114,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f); + ::new ((void*)__f_) _FF(__f); } else { @@ -1122,7 +1122,7 @@ _Ap __a; typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); + ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } @@ -1141,7 +1141,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f, __a0); + ::new ((void*)__f_) _FF(__f, __a0); } else { @@ -1149,7 +1149,7 @@ _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, _Alloc(__a)); + ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } @@ -1394,7 +1394,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f); + ::new ((void*)__f_) _FF(__f); } else { @@ -1402,7 +1402,7 @@ _Ap __a; typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a)); + ::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a)); __f_ = __hold.release(); } } @@ -1421,7 +1421,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(__f, __a0); + ::new ((void*)__f_) _FF(__f, __a0); } else { @@ -1429,7 +1429,7 @@ _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(__f, _Alloc(__a)); + ::new ((void*)__hold.get()) _FF(__f, _Alloc(__a)); __f_ = __hold.release(); } } diff --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base --- a/libcxx/include/__functional_base +++ b/libcxx/include/__functional_base @@ -298,7 +298,7 @@ template struct __invoke_return { - typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type; + typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type; }; #else // defined(_LIBCPP_CXX03_LANG) @@ -314,27 +314,27 @@ #ifndef _LIBCPP_CXX03_LANG template static _Ret __call(_Args&&... __args) { - return __invoke(_VSTD::forward<_Args>(__args)...); + return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); } #else template static _Ret __call(_Fn __f) { - return __invoke(__f); + return _VSTD::__invoke(__f); } template static _Ret __call(_Fn __f, _A0& __a0) { - return __invoke(__f, __a0); + return _VSTD::__invoke(__f, __a0); } template static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) { - return __invoke(__f, __a0, __a1); + return _VSTD::__invoke(__f, __a0, __a1); } template static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){ - return __invoke(__f, __a0, __a1, __a2); + return _VSTD::__invoke(__f, __a0, __a1, __a2); } #endif }; @@ -345,27 +345,27 @@ #ifndef _LIBCPP_CXX03_LANG template static void __call(_Args&&... __args) { - __invoke(_VSTD::forward<_Args>(__args)...); + _VSTD::__invoke(_VSTD::forward<_Args>(__args)...); } #else template static void __call(_Fn __f) { - __invoke(__f); + _VSTD::__invoke(__f); } template static void __call(_Fn __f, _A0& __a0) { - __invoke(__f, __a0); + _VSTD::__invoke(__f, __a0); } template static void __call(_Fn __f, _A0& __a0, _A1& __a1) { - __invoke(__f, __a0, __a1); + _VSTD::__invoke(__f, __a0, __a1); } template static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) { - __invoke(__f, __a0, __a1, __a2); + _VSTD::__invoke(__f, __a0, __a1, __a2); } #endif }; @@ -398,112 +398,112 @@ _LIBCPP_INLINE_VISIBILITY typename __invoke_of::type operator() (_ArgTypes&&... __args) const { - return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); + return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); } #else _LIBCPP_INLINE_VISIBILITY typename __invoke_return::type operator() () const { - return __invoke(get()); + return _VSTD::__invoke(get()); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return0::type operator() (_A0& __a0) const { - return __invoke(get(), __a0); + return _VSTD::__invoke(get(), __a0); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return0::type operator() (_A0 const& __a0) const { - return __invoke(get(), __a0); + return _VSTD::__invoke(get(), __a0); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0& __a0, _A1& __a1) const { - return __invoke(get(), __a0, __a1); + return _VSTD::__invoke(get(), __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0 const& __a0, _A1& __a1) const { - return __invoke(get(), __a0, __a1); + return _VSTD::__invoke(get(), __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0& __a0, _A1 const& __a1) const { - return __invoke(get(), __a0, __a1); + return _VSTD::__invoke(get(), __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0 const& __a0, _A1 const& __a1) const { - return __invoke(get(), __a0, __a1); + return _VSTD::__invoke(get(), __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(get(), __a0, __a1, __a2); + return _VSTD::__invoke(get(), __a0, __a1, __a2); } #endif // _LIBCPP_CXX03_LANG }; diff --git a/libcxx/include/__functional_base_03 b/libcxx/include/__functional_base_03 --- a/libcxx/include/__functional_base_03 +++ b/libcxx/include/__functional_base_03 @@ -40,7 +40,7 @@ template struct __enable_invoke_imp<_Ret, _T1, false, false> { typedef typename add_lvalue_reference< - typename __apply_cv()), _Ret>::type + typename __apply_cv()), _Ret>::type >::type _Bullet4; typedef _Bullet4 type; }; @@ -142,7 +142,7 @@ template inline _LIBCPP_INLINE_VISIBILITY -decltype(_VSTD::declval<_Fp&>()()) +decltype(declval<_Fp&>()()) __invoke(_Fp& __f) { return __f(); @@ -150,7 +150,7 @@ template inline _LIBCPP_INLINE_VISIBILITY -decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>())) +decltype(declval<_Fp&>()(declval<_A0&>())) __invoke(_Fp& __f, _A0& __a0) { return __f(__a0); @@ -158,7 +158,7 @@ template inline _LIBCPP_INLINE_VISIBILITY -decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>())) +decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>())) __invoke(_Fp& __f, _A0& __a0, _A1& __a1) { return __f(__a0, __a1); @@ -166,7 +166,7 @@ template inline _LIBCPP_INLINE_VISIBILITY -decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>())) +decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>())) __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2) { return __f(__a0, __a1, __a2); @@ -181,13 +181,13 @@ template struct __invoke_return<_Fp, false> { - typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type; + typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type; }; template struct __invoke_return0 { - typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type; + typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type; }; template @@ -199,8 +199,8 @@ template struct __invoke_return1 { - typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(), - _VSTD::declval<_A1&>())) type; + typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), + declval<_A1&>())) type; }; template @@ -211,9 +211,9 @@ template struct __invoke_return2 { - typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(), - _VSTD::declval<_A1&>(), - _VSTD::declval<_A2&>())) type; + typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(), + declval<_A1&>(), + declval<_A2&>())) type; }; template diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm --- a/libcxx/include/algorithm +++ b/libcxx/include/algorithm @@ -3404,7 +3404,7 @@ // Move the falses into the temporary buffer, and the trues to the front of the line // Update __first to always point to the end of the trues value_type* __t = __p.first; - ::new(__t) value_type(_VSTD::move(*__first)); + ::new ((void*)__t) value_type(_VSTD::move(*__first)); __d.template __incr(); ++__t; _ForwardIterator __i = __first; @@ -3417,7 +3417,7 @@ } else { - ::new(__t) value_type(_VSTD::move(*__i)); + ::new ((void*)__t) value_type(_VSTD::move(*__i)); __d.template __incr(); ++__t; } @@ -3534,7 +3534,7 @@ // Move the falses into the temporary buffer, and the trues to the front of the line // Update __first to always point to the end of the trues value_type* __t = __p.first; - ::new(__t) value_type(_VSTD::move(*__first)); + ::new ((void*)__t) value_type(_VSTD::move(*__first)); __d.template __incr(); ++__t; _BidirectionalIterator __i = __first; @@ -3547,7 +3547,7 @@ } else { - ::new(__t) value_type(_VSTD::move(*__i)); + ::new ((void*)__t) value_type(_VSTD::move(*__i)); __d.template __incr(); ++__t; } @@ -3922,7 +3922,7 @@ __destruct_n __d(0); unique_ptr __h(__first2, __d); value_type* __last2 = __first2; - ::new(__last2) value_type(_VSTD::move(*__first1)); + ::new ((void*)__last2) value_type(_VSTD::move(*__first1)); __d.template __incr(); for (++__last2; ++__first1 != __last1; ++__last2) { @@ -3930,7 +3930,7 @@ value_type* __i2 = __j2; if (__comp(*__first1, *--__i2)) { - ::new(__j2) value_type(_VSTD::move(*__i2)); + ::new ((void*)__j2) value_type(_VSTD::move(*__i2)); __d.template __incr(); for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) *__j2 = _VSTD::move(*__i2); @@ -3938,7 +3938,7 @@ } else { - ::new(__j2) value_type(_VSTD::move(*__first1)); + ::new ((void*)__j2) value_type(_VSTD::move(*__first1)); __d.template __incr(); } } @@ -4482,14 +4482,14 @@ { value_type* __p = __buff; for (_BidirectionalIterator __i = __first; __i != __middle; __d.template __incr(), (void) ++__i, (void) ++__p) - ::new(__p) value_type(_VSTD::move(*__i)); + ::new ((void*)__p) value_type(_VSTD::move(*__i)); _VSTD::__half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); } else { value_type* __p = __buff; for (_BidirectionalIterator __i = __middle; __i != __last; __d.template __incr(), (void) ++__i, (void) ++__p) - ::new(__p) value_type(_VSTD::move(*__i)); + ::new ((void*)__p) value_type(_VSTD::move(*__i)); typedef reverse_iterator<_BidirectionalIterator> _RBi; typedef reverse_iterator _Rv; _VSTD::__half_inplace_merge(_Rv(__p), _Rv(__buff), @@ -4629,26 +4629,26 @@ if (__first1 == __last1) { for (; __first2 != __last2; ++__first2, ++__result, (void)__d.template __incr()) - ::new (__result) value_type(_VSTD::move(*__first2)); + ::new ((void*)__result) value_type(_VSTD::move(*__first2)); __h.release(); return; } if (__first2 == __last2) { for (; __first1 != __last1; ++__first1, ++__result, (void)__d.template __incr()) - ::new (__result) value_type(_VSTD::move(*__first1)); + ::new ((void*)__result) value_type(_VSTD::move(*__first1)); __h.release(); return; } if (__comp(*__first2, *__first1)) { - ::new (__result) value_type(_VSTD::move(*__first2)); + ::new ((void*)__result) value_type(_VSTD::move(*__first2)); __d.template __incr(); ++__first2; } else { - ::new (__result) value_type(_VSTD::move(*__first1)); + ::new ((void*)__result) value_type(_VSTD::move(*__first1)); __d.template __incr(); ++__first1; } @@ -4702,24 +4702,24 @@ case 0: return; case 1: - ::new(__first2) value_type(_VSTD::move(*__first1)); + ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); return; case 2: __destruct_n __d(0); unique_ptr __h2(__first2, __d); if (__comp(*--__last1, *__first1)) { - ::new(__first2) value_type(_VSTD::move(*__last1)); + ::new ((void*)__first2) value_type(_VSTD::move(*__last1)); __d.template __incr(); ++__first2; - ::new(__first2) value_type(_VSTD::move(*__first1)); + ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); } else { - ::new(__first2) value_type(_VSTD::move(*__first1)); + ::new ((void*)__first2) value_type(_VSTD::move(*__first1)); __d.template __incr(); ++__first2; - ::new(__first2) value_type(_VSTD::move(*__last1)); + ::new ((void*)__first2) value_type(_VSTD::move(*__last1)); } __h2.release(); return; diff --git a/libcxx/include/functional b/libcxx/include/functional --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -1296,7 +1296,7 @@ _LIBCPP_INLINE_VISIBILITY typename __invoke_return::type operator() (_ArgTypes&&... __args) const { - return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); + return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...); } #else @@ -1304,98 +1304,98 @@ _LIBCPP_INLINE_VISIBILITY typename __invoke_return0::type operator() (_A0& __a0) const { - return __invoke(__f_, __a0); + return _VSTD::__invoke(__f_, __a0); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return0::type operator() (_A0 const& __a0) const { - return __invoke(__f_, __a0); + return _VSTD::__invoke(__f_, __a0); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0& __a0, _A1& __a1) const { - return __invoke(__f_, __a0, __a1); + return _VSTD::__invoke(__f_, __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0 const& __a0, _A1& __a1) const { - return __invoke(__f_, __a0, __a1); + return _VSTD::__invoke(__f_, __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0& __a0, _A1 const& __a1) const { - return __invoke(__f_, __a0, __a1); + return _VSTD::__invoke(__f_, __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return1::type operator() (_A0 const& __a0, _A1 const& __a1) const { - return __invoke(__f_, __a0, __a1); + return _VSTD::__invoke(__f_, __a0, __a1); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } template _LIBCPP_INLINE_VISIBILITY typename __invoke_return2::type operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const { - return __invoke(__f_, __a0, __a1, __a2); + return _VSTD::__invoke(__f_, __a0, __a1, __a2); } #endif }; @@ -1609,7 +1609,7 @@ __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<__default_alloc_func>(1); __default_alloc_func* __res = - ::new (__hold.get()) __default_alloc_func(__f_); + ::new ((void*)__hold.get()) __default_alloc_func(__f_); (void)__hold.release(); return __res; } @@ -1700,7 +1700,7 @@ void __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const { - ::new (__p) __func(__f_.__target(), __f_.__get_allocator()); + ::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator()); } template @@ -2154,7 +2154,7 @@ } else { __builtin_new_allocator::__holder_t __hold = __builtin_new_allocator::__allocate_type<_Fun>(1); - __buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f)); + __buf_.__large = ::new ((void*)__hold.get()) _Fun(_VSTD::move(__f)); (void)__hold.release(); } } @@ -2286,7 +2286,7 @@ } virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const { - ::new (__p) __func(__f_); + ::new ((void*)__p) __func(__f_); } virtual void destroy() _NOEXCEPT { @@ -2303,7 +2303,7 @@ } virtual _Rp operator()(_ArgTypes&& ... __arg) { - return __invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...); + return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...); } #ifndef _LIBCPP_NO_RTTI diff --git a/libcxx/include/future b/libcxx/include/future --- a/libcxx/include/future +++ b/libcxx/include/future @@ -652,7 +652,7 @@ unique_lock __lk(this->__mut_); if (this->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); - ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); + ::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); this->__state_ |= base::__constructed | base::ready; __cv_.notify_all(); } @@ -665,7 +665,7 @@ unique_lock __lk(this->__mut_); if (this->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); - ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); + ::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg)); this->__state_ |= base::__constructed; __thread_local_data()->__make_ready_at_thread_exit(this); } @@ -1328,7 +1328,7 @@ typedef __allocator_destructor<_A2> _D2; _A2 __a(__a0); unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); - ::new(static_cast(_VSTD::addressof(*__hold.get()))) _State(__a0); + ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); __state_ = _VSTD::addressof(*__hold.release()); } @@ -1471,7 +1471,7 @@ typedef __allocator_destructor<_A2> _D2; _A2 __a(__a0); unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); - ::new(static_cast(_VSTD::addressof(*__hold.get()))) _State(__a0); + ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); __state_ = _VSTD::addressof(*__hold.release()); } @@ -1590,7 +1590,7 @@ typedef __allocator_destructor<_A2> _D2; _A2 __a(__a0); unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1)); - ::new(static_cast(_VSTD::addressof(*__hold.get()))) _State(__a0); + ::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0); __state_ = _VSTD::addressof(*__hold.release()); } @@ -1655,7 +1655,7 @@ __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to( __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT { - ::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); + ::new ((void*)__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second())); } template @@ -1748,7 +1748,7 @@ typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { - ::new (&__buf_) _FF(_VSTD::forward<_Fp>(__f)); + ::new ((void*)&__buf_) _FF(_VSTD::forward<_Fp>(__f)); __f_ = (__base*)&__buf_; } else @@ -1757,7 +1757,7 @@ _Ap __a; typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); + ::new ((void*)__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a)); __f_ = __hold.release(); } } @@ -1773,7 +1773,7 @@ if (sizeof(_FF) <= sizeof(__buf_)) { __f_ = (__base*)&__buf_; - ::new (__f_) _FF(_VSTD::forward<_Fp>(__f)); + ::new ((void*)__f_) _FF(_VSTD::forward<_Fp>(__f)); } else { @@ -1781,7 +1781,7 @@ _Ap __a(__a0); typedef __allocator_destructor<_Ap> _Dp; unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1)); - ::new (static_cast(_VSTD::addressof(*__hold.get()))) + ::new ((void*)_VSTD::addressof(*__hold.get())) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a)); __f_ = _VSTD::addressof(*__hold.release()); } diff --git a/libcxx/include/memory b/libcxx/include/memory --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -892,18 +892,13 @@ #if _LIBCPP_STD_VER > 17 -template -_LIBCPP_CONSTEXPR_AFTER_CXX17 void* __voidify(_Tp& __ptr) noexcept { - return const_cast(static_cast(_VSTD::addressof(__ptr))); -} - template()) _Tp(_VSTD::declval<_Args>()...) + ::new (declval()) _Tp(declval<_Args>()...) )> _LIBCPP_INLINE_VISIBILITY constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) { _LIBCPP_ASSERT(__location, "null pointer given to construct_at"); - return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); + return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...); } #endif @@ -1617,7 +1612,7 @@ template _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void construct(_Up* __p, _Args&&... __args) { - ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); + ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); } _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY @@ -1694,7 +1689,7 @@ template _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY void construct(_Up* __p, _Args&&... __args) { - ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); + ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); } _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY @@ -1813,10 +1808,10 @@ _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element) - {::new(_VSTD::addressof(*__x_)) _Tp(__element); return *this;} + {::new ((void*)_VSTD::addressof(*__x_)) _Tp(__element); return *this;} #if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element) - {::new(_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;} + {::new ((void*)_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;} #endif _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;} _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) @@ -2895,7 +2890,7 @@ { #endif for (; __f != __l; ++__f, (void) ++__r) - ::new (static_cast(_VSTD::addressof(*__r))) value_type(*__f); + ::new ((void*)_VSTD::addressof(*__r)) value_type(*__f); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2919,7 +2914,7 @@ { #endif for (; __n > 0; ++__f, (void) ++__r, (void) --__n) - ::new (static_cast(_VSTD::addressof(*__r))) value_type(*__f); + ::new ((void*)_VSTD::addressof(*__r)) value_type(*__f); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2943,7 +2938,7 @@ { #endif for (; __f != __l; ++__f) - ::new (static_cast(_VSTD::addressof(*__f))) value_type(__x); + ::new ((void*)_VSTD::addressof(*__f)) value_type(__x); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2966,7 +2961,7 @@ { #endif for (; __n > 0; ++__f, (void) --__n) - ::new (static_cast(_VSTD::addressof(*__f))) value_type(__x); + ::new ((void*)_VSTD::addressof(*__f)) value_type(__x); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -3005,7 +3000,7 @@ try { #endif for (; __idx != __last; ++__idx) - ::new((void*)_VSTD::addressof(*__idx)) _Vt; + ::new ((void*)_VSTD::addressof(*__idx)) _Vt; #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); @@ -3023,7 +3018,7 @@ try { #endif for (; __n > 0; (void)++__idx, --__n) - ::new((void*)_VSTD::addressof(*__idx)) _Vt; + ::new ((void*)_VSTD::addressof(*__idx)) _Vt; return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { @@ -3043,7 +3038,7 @@ try { #endif for (; __idx != __last; ++__idx) - ::new((void*)_VSTD::addressof(*__idx)) _Vt(); + ::new ((void*)_VSTD::addressof(*__idx)) _Vt(); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { _VSTD::destroy(__first, __idx); @@ -3061,7 +3056,7 @@ try { #endif for (; __n > 0; (void)++__idx, --__n) - ::new((void*)_VSTD::addressof(*__idx)) _Vt(); + ::new ((void*)_VSTD::addressof(*__idx)) _Vt(); return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { @@ -3081,7 +3076,7 @@ try { #endif for (; __first != __last; (void)++__idx, ++__first) - ::new((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); + ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); return __idx; #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { @@ -3101,7 +3096,7 @@ try { #endif for (; __n > 0; ++__idx, (void)++__first, --__n) - ::new((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); + ::new ((void*)_VSTD::addressof(*__idx)) _Vt(_VSTD::move(*__first)); return {__first, __idx}; #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) { @@ -3728,8 +3723,7 @@ typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); - ::new(static_cast(_VSTD::addressof(*__hold2.get()))) - _CntrlBlk(__p, __d, __a); + ::new ((void*)_VSTD::addressof(*__hold2.get())) _CntrlBlk(__p, __d, __a); __cntrl_ = _VSTD::addressof(*__hold2.release()); __enable_weak_this(__p, __p); #ifndef _LIBCPP_NO_EXCEPTIONS @@ -3756,8 +3750,7 @@ typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); - ::new(static_cast(_VSTD::addressof(*__hold2.get()))) - _CntrlBlk(__p, __d, __a); + ::new ((void*)_VSTD::addressof(*__hold2.get())) _CntrlBlk(__p, __d, __a); __cntrl_ = _VSTD::addressof(*__hold2.release()); #ifndef _LIBCPP_NO_EXCEPTIONS } @@ -4054,8 +4047,7 @@ _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); - ::new(static_cast(_VSTD::addressof(*__hold2.get()))) - _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...); + ::new ((void*)_VSTD::addressof(*__hold2.get())) _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...); typename shared_ptr<_Tp>::element_type *__p = __hold2->__get_elem(); return shared_ptr<_Tp>::__create_with_control_block(__p, _VSTD::addressof(*__hold2.release())); diff --git a/libcxx/include/optional b/libcxx/include/optional --- a/libcxx/include/optional +++ b/libcxx/include/optional @@ -321,7 +321,7 @@ void __construct(_Args&&... __args) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); - ::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); + ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); this->__engaged_ = true; } diff --git a/libcxx/include/valarray b/libcxx/include/valarray --- a/libcxx/include/valarray +++ b/libcxx/include/valarray @@ -2753,7 +2753,7 @@ __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i) - ::new (__r.__end_) result_type(__expr_[__i]); + ::new ((void*)__r.__end_) result_type(__expr_[__i]); } return __r; } @@ -2774,7 +2774,7 @@ { #endif // _LIBCPP_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) - ::new (__end_) value_type(); + ::new ((void*)__end_) value_type(); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2808,7 +2808,7 @@ { #endif // _LIBCPP_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left) - ::new (__end_) value_type(*__p); + ::new ((void*)__end_) value_type(*__p); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2833,7 +2833,7 @@ { #endif // _LIBCPP_NO_EXCEPTIONS for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p) - ::new (__end_) value_type(*__p); + ::new ((void*)__end_) value_type(*__p); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2871,7 +2871,7 @@ #endif // _LIBCPP_NO_EXCEPTIONS size_t __n_left = __n; for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left) - ::new (__end_) value_type(*__p); + ::new ((void*)__end_) value_type(*__p); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2900,7 +2900,7 @@ #endif // _LIBCPP_NO_EXCEPTIONS size_t __n_left = __n; for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left) - ::new (__end_) value_type(*__p); + ::new ((void*)__end_) value_type(*__p); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2929,7 +2929,7 @@ const value_type* __s = __ga.__vp_; for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_) - ::new (__end_) value_type(__s[*__i]); + ::new ((void*)__end_) value_type(__s[*__i]); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2958,7 +2958,7 @@ const value_type* __s = __ma.__vp_; for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_) - ::new (__end_) value_type(__s[*__i]); + ::new ((void*)__end_) value_type(__s[*__i]); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -2987,7 +2987,7 @@ const value_type* __s = __ia.__vp_; for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_) - ::new (__end_) value_type(__s[*__i]); + ::new ((void*)__end_) value_type(__s[*__i]); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) @@ -3269,7 +3269,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) value_type(+*__p); + ::new ((void*)__r.__end_) value_type(+*__p); } return __r; } @@ -3284,7 +3284,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) value_type(-*__p); + ::new ((void*)__r.__end_) value_type(-*__p); } return __r; } @@ -3299,7 +3299,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) value_type(~*__p); + ::new ((void*)__r.__end_) value_type(~*__p); } return __r; } @@ -3314,7 +3314,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) bool(!*__p); + ::new ((void*)__r.__end_) bool(!*__p); } return __r; } @@ -3649,11 +3649,11 @@ __te = __r.__begin_ + __n; } for (; __r.__end_ != __tb; ++__r.__end_) - ::new (__r.__end_) value_type(); + ::new ((void*)__r.__end_) value_type(); for (; __r.__end_ != __te; ++__r.__end_, ++__sb) - ::new (__r.__end_) value_type(*__sb); + ::new ((void*)__r.__end_) value_type(*__sb); for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_) - ::new (__r.__end_) value_type(); + ::new ((void*)__r.__end_) value_type(); } return __r; } @@ -3670,9 +3670,9 @@ __i %= static_cast(__n); const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i; for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s) - ::new (__r.__end_) value_type(*__s); + ::new ((void*)__r.__end_) value_type(*__s); for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s) - ::new (__r.__end_) value_type(*__s); + ::new ((void*)__r.__end_) value_type(*__s); } return __r; } @@ -3687,7 +3687,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) value_type(__f(*__p)); + ::new ((void*)__r.__end_) value_type(__f(*__p)); } return __r; } @@ -3702,7 +3702,7 @@ { __r.__begin_ = __r.__end_ = allocator().allocate(__n); for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n) - ::new (__r.__end_) value_type(__f(*__p)); + ::new ((void*)__r.__end_) value_type(__f(*__p)); } return __r; } @@ -3733,7 +3733,7 @@ { #endif // _LIBCPP_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) - ::new (__end_) value_type(__x); + ::new ((void*)__end_) value_type(__x); #ifndef _LIBCPP_NO_EXCEPTIONS } catch (...) diff --git a/libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp b/libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/algorithms/robust_against_adl_on_new.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03 + +// + +#include + +#include "test_macros.h" + +struct A { + int i; + A(int v) : i(v) {} + bool operator<(const A& rhs) const { return i < rhs.i; } + static bool isEven(const A& a) { return a.i % 2 == 0; } +}; + +void *operator new(size_t, A*) = delete; + +int main(int, char**) +{ + A a[4] = { 1,2,3,4 }; + std::sort(a, a+4); + std::partition(a, a+4, A::isEven); + std::stable_sort(a, a+4); + std::stable_partition(a, a+4, A::isEven); + + return 0; +} diff --git a/libcxx/test/std/utilities/function.objects/func.memfn/robust_against_adl.pass.cpp b/libcxx/test/std/utilities/function.objects/func.memfn/robust_against_adl.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/func.memfn/robust_against_adl.pass.cpp @@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +#include + +#include "test_macros.h" + +struct Incomplete; +template struct Holder { T t; }; +typedef Holder *Ptr; + +struct A { + Ptr no_args() const { return nullptr; } + Ptr one_arg(Ptr p) const { return p; } + void one_arg_void(Ptr) const { } +}; + +int main(int, char**) +{ + A a; + A *pa = &a; + const A *cpa = &a; + Ptr x = nullptr; + const Ptr cx = nullptr; + std::mem_fn(&A::no_args)(a); + std::mem_fn(&A::no_args)(pa); + std::mem_fn(&A::no_args)(*cpa); + std::mem_fn(&A::no_args)(cpa); + std::mem_fn(&A::one_arg)(a, x); + std::mem_fn(&A::one_arg)(pa, x); + std::mem_fn(&A::one_arg)(a, cx); + std::mem_fn(&A::one_arg)(pa, cx); + std::mem_fn(&A::one_arg)(*cpa, x); + std::mem_fn(&A::one_arg)(cpa, x); + std::mem_fn(&A::one_arg)(*cpa, cx); + std::mem_fn(&A::one_arg)(cpa, cx); + std::mem_fn(&A::one_arg_void)(a, x); + std::mem_fn(&A::one_arg_void)(pa, x); + std::mem_fn(&A::one_arg_void)(a, cx); + std::mem_fn(&A::one_arg_void)(pa, cx); + std::mem_fn(&A::one_arg_void)(*cpa, x); + std::mem_fn(&A::one_arg_void)(cpa, x); + std::mem_fn(&A::one_arg_void)(*cpa, cx); + std::mem_fn(&A::one_arg_void)(cpa, cx); + return 0; +} diff --git a/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/robust_against_adl.pass.cpp b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/robust_against_adl.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/robust_against_adl.pass.cpp @@ -0,0 +1,36 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03 + +// + +#include + +#include "test_macros.h" + +struct Incomplete; +template struct Holder { T t; }; +typedef Holder *Ptr; + +Ptr no_args() { return nullptr; } +Ptr one_arg(Ptr p) { return p; } +Ptr two_args(Ptr p, Ptr) { return p; } +Ptr three_args(Ptr p, Ptr, Ptr) { return p; } +Ptr four_args(Ptr p, Ptr, Ptr, Ptr) { return p; } + +void one_arg_void(Ptr) { } + +int main(int, char**) +{ + Ptr x = nullptr; + std::function f(no_args); f(); + std::function g(one_arg); g(x); + std::function h(one_arg_void); h(x); + return 0; +} diff --git a/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/robust_against_adl.pass.cpp b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/robust_against_adl.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/function.objects/refwrap/refwrap.invoke/robust_against_adl.pass.cpp @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// + +#include + +#include "test_macros.h" + +struct Incomplete; +template struct Holder { T t; }; +typedef Holder *Ptr; + +Ptr no_args() { return nullptr; } +Ptr one_arg(Ptr p) { return p; } +Ptr two_args(Ptr p, Ptr) { return p; } +Ptr three_args(Ptr p, Ptr, Ptr) { return p; } + +void one_arg_void(Ptr) { } + +int main(int, char**) +{ + Ptr x = nullptr; + const Ptr cx = nullptr; + std::ref(no_args)(); + std::ref(one_arg)(x); + std::ref(one_arg)(cx); + std::ref(two_args)(x, x); + std::ref(two_args)(x, cx); + std::ref(two_args)(cx, x); + std::ref(two_args)(cx, cx); + std::ref(three_args)(x, x, x); + std::ref(three_args)(x, x, cx); + std::ref(three_args)(x, cx, x); + std::ref(three_args)(cx, x, x); + std::ref(three_args)(x, cx, cx); + std::ref(three_args)(cx, x, cx); + std::ref(three_args)(cx, cx, x); + std::ref(three_args)(cx, cx, cx); + std::ref(one_arg_void)(x); + std::ref(one_arg_void)(cx); + + return 0; +}