From 8a9ff71f5bbaa6828c82025b5481bed75f6a56c5 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 18 Oct 2016 19:30:38 +0100 Subject: [PATCH] Fix typos in experimental::shared_ptr * include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)): Remove const from parameter. (operator<(const shared_ptr&, nullptr_t)): Use correct specialization of std::less. * testsuite/experimental/memory/shared_ptr/comparison/comparison.cc: Test comparison with nullptr and actually call test functions. From-SVN: r241310 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/experimental/bits/shared_ptr.h | 4 ++-- .../memory/shared_ptr/comparison/comparison.cc | 10 ++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d371b857475..6c08d5493bf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,12 @@ 2016-10-18 Jonathan Wakely + * include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)): + Remove const from parameter. + (operator<(const shared_ptr&, nullptr_t)): Use correct + specialization of std::less. + * testsuite/experimental/memory/shared_ptr/comparison/comparison.cc: + Test comparison with nullptr and actually call test functions. + * include/bits/uses_allocator.h (__is_uses_allocator_constructible_v) (__is_nothrow_uses_allocator_constructible_v): Only define for C++14 and later. diff --git a/libstdc++-v3/include/experimental/bits/shared_ptr.h b/libstdc++-v3/include/experimental/bits/shared_ptr.h index d61789ad32a..7a232f4d34e 100644 --- a/libstdc++-v3/include/experimental/bits/shared_ptr.h +++ b/libstdc++-v3/include/experimental/bits/shared_ptr.h @@ -672,7 +672,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION shared_ptr(const shared_ptr<_Tp1>& __r) noexcept : _Base_type(__r) { } - shared_ptr(const shared_ptr<_Tp>&& __r) noexcept + shared_ptr(shared_ptr&& __r) noexcept : _Base_type(std::move(__r)) { } template> @@ -815,7 +815,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator<(const shared_ptr<_Tp>& __a, nullptr_t) noexcept { using __elem_t = typename shared_ptr<_Tp>::element_type; - return std::less<__elem_t>()(__a.get(), nullptr); + return std::less<__elem_t*>()(__a.get(), nullptr); } template diff --git a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc index fafa6eb1364..d73381158ac 100644 --- a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc +++ b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc @@ -73,8 +73,18 @@ test02() return 0; } +void +test03() +{ + std::experimental::shared_ptr a(new A[5]); + VERIFY( nullptr < a ); +} + int main() { + test01(); + test02(); + test03(); return 0; } -- 2.30.2