erik.pilkington updated this revision to Diff 91385.
erik.pilkington added a comment.

This new patch replaces the allocator from `allocator<void>` to 
`allocator<int>`, I didn't realize `allocator<void>` was deprecated.
Thanks,
Erik


https://reviews.llvm.org/D30837

Files:
  include/memory
  
test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp

Index: test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
===================================================================
--- test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
+++ test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp
@@ -45,6 +45,9 @@
     virtual ~Foo() = default;
 };
 
+struct Result {};
+void resultDeletor(Result (*)()) {}
+Result theFunction() { return Result(); }
 
 int main()
 {
@@ -65,7 +68,9 @@
     std::shared_ptr<const Foo> p2 = std::make_shared<const Foo>();
     assert(p2.get());
     }
-
+    { // https://bugs.llvm.org/show_bug.cgi?id=27566
+      std::shared_ptr<Result()> x(&theFunction, &resultDeletor);
+    }
 #if TEST_STD_VER >= 11
     nc = globalMemCounter.outstanding_new;
     {
Index: include/memory
===================================================================
--- include/memory
+++ include/memory
@@ -3884,8 +3884,7 @@
             }
         }
 
-    _LIBCPP_INLINE_VISIBILITY
-    void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+    _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
 
     template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
     template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -3916,8 +3915,8 @@
     : __ptr_(__p)
 {
     unique_ptr<_Yp> __hold(__p);
-    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-    __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<int> > _CntrlBlk;
+    __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<int>());
     __hold.release();
     __enable_weak_this(__p, __p);
 }
@@ -3932,8 +3931,8 @@
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<int> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, allocator<int>());
         __enable_weak_this(__p, __p);
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
@@ -3954,8 +3953,8 @@
     try
     {
 #endif  // _LIBCPP_NO_EXCEPTIONS
-        typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<_Tp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+        typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<int> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__p, __d, allocator<int>());
 #ifndef _LIBCPP_NO_EXCEPTIONS
     }
     catch (...)
@@ -4094,8 +4093,8 @@
                             typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type)
     : __ptr_(__r.get())
 {
-    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
-    __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<_Yp>());
+    typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<int> > _CntrlBlk;
+    __cntrl_ = new _CntrlBlk(__r.get(), default_delete<_Yp>(), allocator<int>());
     __enable_weak_this(__r.get(), __r.get());
     __r.release();
 }
@@ -4123,8 +4122,8 @@
     else
 #endif
     {
-        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+        typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<int> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<int>());
         __enable_weak_this(__r.get(), __r.get());
     }
     __r.release();
@@ -4154,8 +4153,8 @@
     {
         typedef __shared_ptr_pointer<_Yp*,
                                      reference_wrapper<typename remove_reference<_Dp>::type>,
-                                     allocator<_Yp> > _CntrlBlk;
-        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+                                     allocator<int> > _CntrlBlk;
+        __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<int>());
         __enable_weak_this(__r.get(), __r.get());
     }
     __r.release();
@@ -4168,12 +4167,13 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_Args&& ...__args)
 {
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef __shared_ptr_emplace<_Tp, allocator<int> > _CntrlBlk;
     typedef allocator<_CntrlBlk> _A2;
     typedef __allocator_destructor<_A2> _D2;
     _A2 __a2;
     unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
+    ::new(__hold2.get()) _CntrlBlk(allocator<int>(),
+                                   _VSTD::forward<_Args>(__args)...);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
     __r.__cntrl_ = __hold2.release();
@@ -4206,12 +4206,12 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared()
 {
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef __shared_ptr_emplace<_Tp, allocator<int> > _CntrlBlk;
     typedef allocator<_CntrlBlk> _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2;
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__alloc2);
+    ::new(__hold2.get()) _CntrlBlk(allocator<int>());
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
     __r.__cntrl_ = __hold2.release();
@@ -4224,12 +4224,12 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_A0& __a0)
 {
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef __shared_ptr_emplace<_Tp, allocator<int> > _CntrlBlk;
     typedef allocator<_CntrlBlk> _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2;
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0);
+    ::new(__hold2.get()) _CntrlBlk(allocator<int>(), __a0);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
     __r.__cntrl_ = __hold2.release();
@@ -4242,12 +4242,12 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1)
 {
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef __shared_ptr_emplace<_Tp, allocator<int> > _CntrlBlk;
     typedef allocator<_CntrlBlk> _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2;
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1);
+    ::new(__hold2.get()) _CntrlBlk(allocator<int>(), __a0, __a1);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
     __r.__cntrl_ = __hold2.release();
@@ -4260,12 +4260,12 @@
 shared_ptr<_Tp>
 shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
 {
-    typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
+    typedef __shared_ptr_emplace<_Tp, allocator<int> > _CntrlBlk;
     typedef allocator<_CntrlBlk> _Alloc2;
     typedef __allocator_destructor<_Alloc2> _D2;
     _Alloc2 __alloc2;
     unique_ptr<_CntrlBlk, _D2> __hold2(__alloc2.allocate(1), _D2(__alloc2, 1));
-    ::new(__hold2.get()) _CntrlBlk(__alloc2, __a0, __a1, __a2);
+    ::new(__hold2.get()) _CntrlBlk(allocator<int>(), __a0, __a1, __a2);
     shared_ptr<_Tp> __r;
     __r.__ptr_ = __hold2.get()->get();
     __r.__cntrl_ = __hold2.release();
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to