Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236953 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -58,6 +58,9 @@ int A::count = 0;
|
||||
void fn ( const std::shared_ptr<int> &) {}
|
||||
void fn ( const std::shared_ptr<B> &) { assert (false); }
|
||||
|
||||
template <typename T>
|
||||
void assert_deleter ( T * ) { assert(false); }
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -100,4 +103,13 @@ int main()
|
||||
throw_next = false;
|
||||
fn(std::unique_ptr<int>(new int));
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201402L
|
||||
// LWG 2415
|
||||
{
|
||||
std::unique_ptr<int, void (*)(int*)> p(nullptr, assert_deleter<int>);
|
||||
std::shared_ptr<int> p2(std::move(p)); // should not call deleter when going out of scope
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user