diff --git a/core/shared_ptr.hh b/core/shared_ptr.hh index 032d001775..a5f9c24dba 100644 --- a/core/shared_ptr.hh +++ b/core/shared_ptr.hh @@ -274,6 +274,9 @@ public: template friend class shared_ptr; + + template + friend struct shared_ptr_make_helper; }; template @@ -418,7 +421,8 @@ template struct shared_ptr_make_helper { template static shared_ptr make(A&&... a) { - return shared_ptr(new T(std::forward(a)...)); + auto p = new T(std::forward(a)...); + return shared_ptr(p, p); } }; @@ -426,7 +430,7 @@ template inline shared_ptr make_shared(A&&... a) { - using helper = shared_ptr_make_helper, T>::value>; + using helper = shared_ptr_make_helper::value>; return helper::make(std::forward(a)...); } @@ -434,7 +438,7 @@ template inline shared_ptr make_shared(T&& a) { - using helper = shared_ptr_make_helper, T>::value>; + using helper = shared_ptr_make_helper::value>; return helper::make(std::forward(a)); }