diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-12-07 15:56:14 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2016-12-07 15:56:14 +0000 |
commit | 20e415ce5f8dcad1b52727d0fa31ea29b9be30fa (patch) | |
tree | 6abac54edc2a5a1deb84ac54283ceccd7db4a241 /libstdc++-v3 | |
parent | f5be17f105f854ba15e586eb668ce5ad16bf0e91 (diff) | |
download | gcc-20e415ce5f8dcad1b52727d0fa31ea29b9be30fa.tar.gz |
Fix typos in experimental::shared_ptr
Backport from mainline
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.
From-SVN: r243364
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/experimental/bits/shared_ptr.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc | 10 |
3 files changed, 22 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 80f68359b2c..cc69f2a1fdb 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,6 +1,16 @@ 2016-12-07 Jonathan Wakely <jwakely@redhat.com> Backport from mainline + 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. + + Backport from mainline 2016-10-11 Jonathan Wakely <jwakely@redhat.com> * doc/xml/manual/intro.xml: Document LWG 2484 status. 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<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> 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 66f8faccd53..d47289e7562 100644 --- a/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc +++ b/libstdc++-v3/testsuite/experimental/memory/shared_ptr/comparison/comparison.cc @@ -77,8 +77,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; } |