Fix typos in experimental::shared_ptr
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Oct 2016 18:30:38 +0000 (19:30 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 18 Oct 2016 18:30:38 +0000 (19:30 +0100)
* include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)):
Remove const from parameter.
(operator<(const shared_ptr<T>&, 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
libstdc++-v3/include/experimental/bits/shared_ptr.h
libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc

index d371b857475835f94f50e00e265e6faa7e016231..6c08d5493bf7d3eba112ddc9037ee0a9a6d18999 100644 (file)
@@ -1,5 +1,12 @@
 2016-10-18  Jonathan Wakely  <jwakely@redhat.com>
 
+       * include/experimental/bits/shared_ptr.h (shared_ptr(shared_ptr&&)):
+       Remove const from parameter.
+       (operator<(const shared_ptr<T>&, 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.
index d61789ad32a471561b5f46c13b0de2eee72979ac..7a232f4d34e70896b7eeffa0e6bd8590279bd507 100644 (file)
@@ -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<typename _Tp1, typename = _Compatible<_Tp1>>
@@ -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<typename _Tp>
index fafa6eb13649ac1a7ef9e8aac73539d33516b3c6..d73381158acb2e8bdc2892ecb6a120e238b9b6c6 100644 (file)
@@ -73,8 +73,18 @@ test02()
   return 0;
 }
 
+void
+test03()
+{
+  std::experimental::shared_ptr<A[5]> a(new A[5]);
+  VERIFY( nullptr < a );
+}
+
 int
 main()
 {
+  test01();
+  test02();
+  test03();
   return 0;
 }