diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h index 00db96185be7c65..7b5002cb95d32b8 100644 --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -404,7 +404,7 @@ struct __shared_ptr_deleter_ctor_reqs { }; template -using __shared_ptr_nullptr_deleter_ctor_reqs = _And, __well_formed_deleter<_Dp, nullptr_t> >; +using __shared_ptr_nullptr_deleter_ctor_reqs = _And, __well_formed_deleter<_Dp, _Tp*> >; #if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI) # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp index 13340ed5294c050..4ea752b36bd018e 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter.pass.cpp @@ -32,17 +32,16 @@ int A::count = 0; // LWG 3233. Broken requirements for shared_ptr converting constructors // https://cplusplus.github.io/LWG/issue3233 static_assert( std::is_constructible, std::nullptr_t, test_deleter >::value, ""); -static_assert(!std::is_constructible, std::nullptr_t, bad_deleter>::value, ""); -static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter>::value, ""); +static_assert(!std::is_constructible, std::nullptr_t, bad_deleter>::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter>::value, ""); #if TEST_STD_VER >= 17 -static_assert( std::is_constructible, std::nullptr_t, test_deleter >::value, ""); +static_assert(std::is_constructible, std::nullptr_t, test_deleter >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, bad_deleter>::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter>::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter>::value, ""); -static_assert( std::is_constructible, std::nullptr_t, test_deleter >::value, ""); +static_assert(std::is_constructible, std::nullptr_t, test_deleter >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, bad_deleter>::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter>::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter>::value, ""); diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp index 53ca6fb5b234d40..a479b24c4595ab7 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/nullptr_t_deleter_allocator.pass.cpp @@ -33,17 +33,21 @@ int A::count = 0; // LWG 3233. Broken requirements for shared_ptr converting constructors // https://cplusplus.github.io/LWG/issue3233 static_assert( std::is_constructible, std::nullptr_t, test_deleter, test_allocator >::value, ""); -static_assert(!std::is_constructible, std::nullptr_t, bad_deleter, test_allocator >::value, ""); -static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter, test_allocator >::value, ""); +static_assert(!std::is_constructible, std::nullptr_t, bad_deleter, test_allocator >::value, + ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter, test_allocator >::value, ""); #if TEST_STD_VER >= 17 -static_assert( std::is_constructible, std::nullptr_t, test_deleter, test_allocator >::value, ""); +static_assert( + std::is_constructible, std::nullptr_t, test_deleter, test_allocator >::value, + ""); static_assert(!std::is_constructible, std::nullptr_t, bad_deleter, test_allocator >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter, test_allocator >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter, test_allocator >::value, ""); -static_assert( std::is_constructible, std::nullptr_t, test_deleter, test_allocator >::value, ""); +static_assert( + std::is_constructible, std::nullptr_t, test_deleter, test_allocator >::value, + ""); static_assert(!std::is_constructible, std::nullptr_t, bad_deleter, test_allocator >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_nullptr_deleter, test_allocator >::value, ""); static_assert(!std::is_constructible, std::nullptr_t, no_move_deleter, test_allocator >::value, ""); diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp index 562acf56d96fe12..97dd2fcb22d1a39 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter.pass.cpp @@ -115,6 +115,14 @@ int main(int, char**) } #endif // TEST_STD_VER >= 11 +#if TEST_STD_VER >= 14 + { + // See https://github.com/llvm/llvm-project/pull/93071#issuecomment-2158494851 + auto deleter = [](auto pointer) { delete pointer; }; + std::shared_ptr p(new int, deleter); + } +#endif + test_function_type(); return 0; } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp index 9dffbcdd59a735d..b90c69efd94abb0 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer_deleter_allocator.pass.cpp @@ -165,5 +165,13 @@ int main(int, char**) test_allocator >::value, ""); } +#if TEST_STD_VER >= 14 + { + // See https://github.com/llvm/llvm-project/pull/93071#issuecomment-2158494851 + auto deleter = [](auto pointer) { delete pointer; }; + std::shared_ptr p(new int, deleter, std::allocator()); + } +#endif + return 0; }