diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-05-10 13:59:45 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-05-10 13:59:45 +0000 |
commit | c34f847b805325e167d09304f387a654a542175d (patch) | |
tree | b5e38d1604344a5828fa68e51ddf6ef37b3e6a9e /libcxx/test/std/utilities/memory | |
parent | 0b0671ae36d8cab4ba8f1129b3c754b95ade6118 (diff) | |
download | bcm5719-llvm-c34f847b805325e167d09304f387a654a542175d.tar.gz bcm5719-llvm-c34f847b805325e167d09304f387a654a542175d.zip |
Fix for LWG Issue 2415: Inconsistency between unique_ptr and shared_ptr
llvm-svn: 236953
Diffstat (limited to 'libcxx/test/std/utilities/memory')
2 files changed, 14 insertions, 2 deletions
diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp index 742d8c1b2dd..30e0fce21e0 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/unique_ptr_Y.pass.cpp @@ -67,7 +67,7 @@ int main() pB = std::move(pA); assert(B::count == 0); assert(A::count == 0); - assert(pB.use_count() == 1); +// assert(pB.use_count() == 1); // no longer true due to LWG 2415 assert(pA.get() == 0); assert(pB.get() == ptrA); } @@ -101,7 +101,7 @@ int main() pB = std::move(pA); assert(B::count == 0); assert(A::count == 0); - assert(pB.use_count() == 1); +// assert(pB.use_count() == 1); // no longer true due to LWG 2415 assert(pA.get() == 0); assert(pB.get() == ptrA); } diff --git a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp index 68b9b288100..5e09d9a7934 100644 --- a/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp +++ b/libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/unique_ptr.pass.cpp @@ -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 + } |