<div dir="ltr">My bad Nico. I think I looked at that doc a while ago but forgot the guidelines. I will make sure my next commit message has shorter lines, that it has a title/body, and that it follows the other guidelines. Thanks for letting me know.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 14, 2019 at 10:31 AM Nico Weber <<a href="mailto:thakis@chromium.org">thakis@chromium.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Zoe,<div><br></div><div>could you try to keep commit message line length a bit shorter? It's optional, but nice for folks who look at `git log` in the terminal. See also <a href="https://llvm.org/docs/DeveloperPolicy.html#commit-messages" target="_blank">https://llvm.org/docs/DeveloperPolicy.html#commit-messages</a></div><div><br>Thanks,</div><div>Nico</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 14, 2019 at 1:18 PM Zoe Carver via libcxx-commits <<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: zoecarver<br>
Date: Wed Aug 14 10:19:25 2019<br>
New Revision: 368885<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=368885&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=368885&view=rev</a><br>
Log:<br>
This commit removes std::shared_ptr::make_shared and std::shared_ptr::allocate_shared as they are not part of the standard. This commit also adds the helper function "__create_with_cntrl_block" which std::allocate_shared and std::make_shared have been updated to use.<br>
<br>
Modified:<br>
    libcxx/trunk/include/memory<br>
<br>
Modified: libcxx/trunk/include/memory<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=368885&r1=368884&r2=368885&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=368885&r1=368884&r2=368885&view=diff</a><br>
==============================================================================<br>
--- libcxx/trunk/include/memory (original)<br>
+++ libcxx/trunk/include/memory Wed Aug 14 10:19:25 2019<br>
@@ -3831,48 +3831,16 @@ public:<br>
                       : nullptr);}<br>
 #endif  // _LIBCPP_NO_RTTI<br>
<br>
-#ifndef _LIBCPP_HAS_NO_VARIADICS<br>
-<br>
-    template<class ..._Args><br>
-        static<br>
-        shared_ptr<_Tp><br>
-        make_shared(_Args&& ...__args);<br>
-<br>
-    template<class _Alloc, class ..._Args><br>
-        static<br>
-        shared_ptr<_Tp><br>
-        allocate_shared(const _Alloc& __a, _Args&& ...__args);<br>
-<br>
-#else  // _LIBCPP_HAS_NO_VARIADICS<br>
-<br>
-    static shared_ptr<_Tp> make_shared();<br>
-<br>
-    template<class _A0><br>
-        static shared_ptr<_Tp> make_shared(_A0&);<br>
-<br>
-    template<class _A0, class _A1><br>
-        static shared_ptr<_Tp> make_shared(_A0&, _A1&);<br>
-<br>
-    template<class _A0, class _A1, class _A2><br>
-        static shared_ptr<_Tp> make_shared(_A0&, _A1&, _A2&);<br>
-<br>
-    template<class _Alloc><br>
-        static shared_ptr<_Tp><br>
-        allocate_shared(const _Alloc& __a);<br>
-<br>
-    template<class _Alloc, class _A0><br>
-        static shared_ptr<_Tp><br>
-        allocate_shared(const _Alloc& __a, _A0& __a0);<br>
-<br>
-    template<class _Alloc, class _A0, class _A1><br>
-        static shared_ptr<_Tp><br>
-        allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1);<br>
-<br>
-    template<class _Alloc, class _A0, class _A1, class _A2><br>
-        static shared_ptr<_Tp><br>
-        allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2);<br>
-<br>
-#endif  // _LIBCPP_HAS_NO_VARIADICS<br>
+    template<class _Yp, class _CntrlBlk><br>
+    static shared_ptr<_Tp><br>
+    __create_with_cntrl_block(_Yp* __p, _CntrlBlk* __cntrl)<br>
+    {<br>
+        shared_ptr<_Tp> __r;<br>
+        __r.__ptr_ = __p;<br>
+        __r.__cntrl_ = __cntrl;<br>
+        __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
+        return __r;<br>
+    }<br>
<br>
 private:<br>
     template <class _Yp, bool = is_function<_Yp>::value><br>
@@ -4186,206 +4154,6 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_<br>
     __r.release();<br>
 }<br>
<br>
-#ifndef _LIBCPP_HAS_NO_VARIADICS<br>
-<br>
-template<class _Tp><br>
-template<class ..._Args><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::make_shared(_Args&& ...__args)<br>
-{<br>
-    static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
-    typedef allocator<_CntrlBlk> _A2;<br>
-    typedef __allocator_destructor<_A2> _D2;<br>
-    _A2 __a2;<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));<br>
-    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = __hold2.release();<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _Alloc, class ..._Args><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _Args&& ...__args)<br>
-{<br>
-    static_assert( is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
-    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;<br>
-    typedef __allocator_destructor<_A2> _D2;<br>
-    _A2 __a2(__a);<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));<br>
-    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
-        _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-#else  // _LIBCPP_HAS_NO_VARIADICS<br>
-<br>
-template<class _Tp><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::make_shared()<br>
-{<br>
-    static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
-    typedef allocator<_CntrlBlk> _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2;<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(__hold2.get()) _CntrlBlk(__alloc2);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = __hold2.release();<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _A0><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::make_shared(_A0& __a0)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in make_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
-    typedef allocator<_CntrlBlk> _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2;<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = __hold2.release();<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _A0, class _A1><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in make_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
-    typedef allocator<_CntrlBlk> _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2;<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = __hold2.release();<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _A0, class _A1, class _A2><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
-    typedef allocator<_CntrlBlk> _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2;<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = __hold2.release();<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _Alloc><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::allocate_shared(const _Alloc& __a)<br>
-{<br>
-    static_assert((is_constructible<_Tp>::value), "Can't construct object in allocate_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
-    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2(__a);<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
-        _CntrlBlk(__a);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _Alloc, class _A0><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in allocate_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
-    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2(__a);<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
-        _CntrlBlk(__a, __a0);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _Alloc, class _A0, class _A1><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in allocate_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
-    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2(__a);<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
-        _CntrlBlk(__a, __a0, __a1);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-template<class _Tp><br>
-template<class _Alloc, class _A0, class _A1, class _A2><br>
-shared_ptr<_Tp><br>
-shared_ptr<_Tp>::allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)<br>
-{<br>
-    static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );<br>
-    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
-    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
-    typedef __allocator_destructor<_Alloc2> _D2;<br>
-    _Alloc2 __alloc2(__a);<br>
-    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
-    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
-        _CntrlBlk(__a, __a0, __a1, __a2);<br>
-    shared_ptr<_Tp> __r;<br>
-    __r.__ptr_ = __hold2.get()->get();<br>
-    __r.__cntrl_ = _VSTD::addressof(*__hold2.release());<br>
-    __r.__enable_weak_this(__r.__ptr_, __r.__ptr_);<br>
-    return __r;<br>
-}<br>
-<br>
-#endif  // _LIBCPP_HAS_NO_VARIADICS<br>
-<br>
 template<class _Tp><br>
 shared_ptr<_Tp>::~shared_ptr()<br>
 {<br>
@@ -4578,7 +4346,17 @@ typename enable_if<br>
 >::type<br>
 make_shared(_Args&& ...__args)<br>
 {<br>
-    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);<br>
+    static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in make_shared");<br>
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
+    typedef allocator<_CntrlBlk> _A2;<br>
+    typedef __allocator_destructor<_A2> _D2;<br>
+<br>
+    _A2 __a2;<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));<br>
+    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);<br>
+<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      __hold2.release());<br>
 }<br>
<br>
 template<class _Tp, class _Alloc, class ..._Args><br>
@@ -4590,73 +4368,145 @@ typename enable_if<br>
 >::type<br>
 allocate_shared(const _Alloc& __a, _Args&& ...__args)<br>
 {<br>
-    return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);<br>
+    static_assert(is_constructible<_Tp, _Args...>::value, "Can't construct object in allocate_shared");<br>
+<br>
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2;<br>
+    typedef __allocator_destructor<_A2> _D2;<br>
+<br>
+    _A2 __a2(__a);<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));<br>
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
+        _CntrlBlk(__a, _VSTD::forward<_Args>(__args)...);<br>
+<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      _VSTD::addressof(*__hold2.release()));<br>
 }<br>
<br>
 #else  // _LIBCPP_HAS_NO_VARIADICS<br>
<br>
 template<class _Tp><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 make_shared()<br>
 {<br>
-    return shared_ptr<_Tp>::make_shared();<br>
+    static_assert((is_constructible<_Tp>::value), "Can't construct object in make_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
+    typedef allocator<_CntrlBlk> _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2;<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(__hold2.get()) _CntrlBlk(__alloc2);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      __hold2.release());<br>
 }<br>
<br>
 template<class _Tp, class _A0><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 make_shared(_A0& __a0)<br>
 {<br>
-    return shared_ptr<_Tp>::make_shared(__a0);<br>
+    static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in make_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
+    typedef allocator<_CntrlBlk> _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2;<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      __hold2.release());<br>
 }<br>
<br>
 template<class _Tp, class _A0, class _A1><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 make_shared(_A0& __a0, _A1& __a1)<br>
 {<br>
-    return shared_ptr<_Tp>::make_shared(__a0, __a1);<br>
+    static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in make_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
+    typedef allocator<_CntrlBlk> _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2;<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      __hold2.release());<br>
 }<br>
<br>
 template<class _Tp, class _A0, class _A1, class _A2><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 make_shared(_A0& __a0, _A1& __a1, _A2& __a2)<br>
 {<br>
-    return shared_ptr<_Tp>::make_shared(__a0, __a1, __a2);<br>
+    static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;<br>
+    typedef allocator<_CntrlBlk> _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2;<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      __hold2.release());<br>
 }<br>
<br>
 template<class _Tp, class _Alloc><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 allocate_shared(const _Alloc& __a)<br>
 {<br>
-    return shared_ptr<_Tp>::allocate_shared(__a);<br>
+    static_assert((is_constructible<_Tp>::value), "Can't construct object in allocate_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2(__a);<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
+        _CntrlBlk(__a);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      _VSTD::addressof(*__hold2.release()));<br>
 }<br>
<br>
 template<class _Tp, class _Alloc, class _A0><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 allocate_shared(const _Alloc& __a, _A0& __a0)<br>
 {<br>
-    return shared_ptr<_Tp>::allocate_shared(__a, __a0);<br>
+    static_assert((is_constructible<_Tp, _A0>::value), "Can't construct object in allocate_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2(__a);<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
+        _CntrlBlk(__a, __a0);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      _VSTD::addressof(*__hold2.release()));<br>
 }<br>
<br>
 template<class _Tp, class _Alloc, class _A0, class _A1><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1)<br>
 {<br>
-    return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1);<br>
+    static_assert((is_constructible<_Tp, _A0, _A1>::value), "Can't construct object in allocate_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2(__a);<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
+        _CntrlBlk(__a, __a0, __a1);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      _VSTD::addressof(*__hold2.release()));<br>
 }<br>
<br>
 template<class _Tp, class _Alloc, class _A0, class _A1, class _A2><br>
-inline _LIBCPP_INLINE_VISIBILITY<br>
 shared_ptr<_Tp><br>
 allocate_shared(const _Alloc& __a, _A0& __a0, _A1& __a1, _A2& __a2)<br>
 {<br>
-    return shared_ptr<_Tp>::allocate_shared(__a, __a0, __a1, __a2);<br>
+    static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );<br>
+    typedef __shared_ptr_emplace<_Tp, _Alloc> _CntrlBlk;<br>
+    typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _Alloc2;<br>
+    typedef __allocator_destructor<_Alloc2> _D2;<br>
+    _Alloc2 __alloc2(__a);<br>
+    unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));<br>
+    ::new(static_cast<void*>(_VSTD::addressof(*__hold2.get())))<br>
+        _CntrlBlk(__a, __a0, __a1, __a2);<br>
+    return shared_ptr<_Tp>::__create_with_cntrl_block(__hold2.get()->get(),<br>
+                                                      _VSTD::addressof(*__hold2.release()));<br>
 }<br>
<br>
 #endif  // _LIBCPP_HAS_NO_VARIADICS<br>
<br>
<br>
_______________________________________________<br>
libcxx-commits mailing list<br>
<a href="mailto:libcxx-commits@lists.llvm.org" target="_blank">libcxx-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/libcxx-commits</a><br>
</blockquote></div>
</blockquote></div>