From c374716e4e890f5fcde1c32a39ca75cb359c66f1 Mon Sep 17 00:00:00 2001 From: paolo Date: Tue, 16 Feb 2010 16:01:23 +0000 Subject: [PATCH] 2010-02-16 Paolo Carlini * include/bits/unique_ptr.h: (unique_ptr<>:: unique_ptr(const unique_ptr<_Up, _Up_Deleter>&), operator=(const unique_ptr<_Up, _Up_Deleter>&)): Remove, redundant, per DR 1303. * include/bits/shared_ptr.h (shared_ptr<>:: shared_ptr(const unique_ptr<_Up, _Up_Deleter>&), operator=(const unique_ptr<_Up, _Up_Deleter>&)): Likewise. * include/bits/shared_ptr_base.h (__shared_ptr<>:: __shared_ptr(const unique_ptr<_Up, _Up_Deleter>&), operator=(const unique_ptr<_Up, _Up_Deleter>&)): Likewise. * testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Adjust. * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Likewise. * testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc: Likewise. * testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156807 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 18 ++++++++++++++++++ libstdc++-v3/include/bits/shared_ptr.h | 11 ++--------- libstdc++-v3/include/bits/shared_ptr_base.h | 9 +-------- libstdc++-v3/include/bits/unique_ptr.h | 10 ++-------- .../20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc | 6 +++--- .../20_util/shared_ptr/cons/unique_ptr_neg.cc | 6 +++--- .../testsuite/20_util/unique_ptr/assign/assign_neg.cc | 4 ++-- .../20_util/unique_ptr/modifiers/reset_neg.cc | 2 +- 8 files changed, 32 insertions(+), 34 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4500583..183a4cc 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,21 @@ +2010-02-16 Paolo Carlini + + * include/bits/unique_ptr.h: (unique_ptr<>:: + unique_ptr(const unique_ptr<_Up, _Up_Deleter>&), + operator=(const unique_ptr<_Up, _Up_Deleter>&)): Remove, redundant, + per DR 1303. + * include/bits/shared_ptr.h (shared_ptr<>:: + shared_ptr(const unique_ptr<_Up, _Up_Deleter>&), + operator=(const unique_ptr<_Up, _Up_Deleter>&)): Likewise. + * include/bits/shared_ptr_base.h (__shared_ptr<>:: + __shared_ptr(const unique_ptr<_Up, _Up_Deleter>&), + operator=(const unique_ptr<_Up, _Up_Deleter>&)): Likewise. + * testsuite/20_util/unique_ptr/modifiers/reset_neg.cc: Adjust. + * testsuite/20_util/unique_ptr/assign/assign_neg.cc: Likewise. + * testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc: Likewise. + * testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc: + Likewise. + 2010-02-15 Paolo Carlini * testsuite/ext/median.cc: Adjust. diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index 8119ad3..3e909f5 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -60,7 +60,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) /// 2.2.3.7 shared_ptr I/O template - std::basic_ostream<_Ch, _Tr>& + inline std::basic_ostream<_Ch, _Tr>& operator<<(std::basic_ostream<_Ch, _Tr>& __os, const __shared_ptr<_Tp, _Lp>& __p) { @@ -119,7 +119,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) * * __shared_ptr will release __p by calling __d(__p) */ - template + template shared_ptr(_Tp1* __p, _Deleter __d) : __shared_ptr<_Tp>(__p, __d) { } /** @@ -210,9 +210,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) #endif template - explicit shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete; - - template explicit shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) : __shared_ptr<_Tp>(std::move(__r)) { } @@ -251,10 +248,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template shared_ptr& - operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete; - - template - shared_ptr& operator=(std::unique_ptr<_Tp1, _Del>&& __r) { this->__shared_ptr<_Tp>::operator=(std::move(__r)); diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index ff1282d..51bd51d 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -1,6 +1,6 @@ // shared_ptr and weak_ptr implementation details -*- C++ -*- -// Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. +// Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -606,9 +606,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _M_ptr = __r._M_ptr; } - template - explicit __shared_ptr(const std::unique_ptr<_Tp1, _Del>&) = delete; - // If an exception is thrown this constructor has no effect. template explicit __shared_ptr(std::unique_ptr<_Tp1, _Del>&& __r) @@ -670,10 +667,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) template __shared_ptr& - operator=(const std::unique_ptr<_Tp1, _Del>& __r) = delete; - - template - __shared_ptr& operator=(std::unique_ptr<_Tp1, _Del>&& __r) { __shared_ptr(std::move(__r)).swap(*this); diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index 9a34b03..7134865 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -149,7 +149,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) } // Observers. - typename std::add_lvalue_reference::type operator*() const + typename std::add_lvalue_reference::type + operator*() const { _GLIBCXX_DEBUG_ASSERT(get() != 0); return *get(); @@ -207,15 +208,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Disable copy from lvalue. unique_ptr(const unique_ptr&) = delete; - - template - unique_ptr(const unique_ptr<_Up, _Up_Deleter>&) = delete; - unique_ptr& operator=(const unique_ptr&) = delete; - template - unique_ptr& operator=(const unique_ptr<_Up, _Up_Deleter>&) = delete; - private: __tuple_type _M_t; }; diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc index b4fc826..dae967b 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/assign/unique_ptr_lvalue_neg.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation +// Copyright (C) 2008, 2009, 2010 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -35,7 +35,7 @@ test01() std::shared_ptr a; std::unique_ptr u; - a = u; // { dg-error "used here" } + a = u; // { dg-error "cannot bind" } return 0; } @@ -46,4 +46,4 @@ main() test01(); return 0; } -// { dg-excess-errors "deleted function" } +// { dg-excess-errors "initializing argument" } diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc index 37bdb0b..0e2fd68 100644 --- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc +++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/unique_ptr_neg.cc @@ -1,7 +1,7 @@ // { dg-options "-std=gnu++0x" } // { dg-do compile } -// Copyright (C) 2008, 2009 Free Software Foundation +// Copyright (C) 2008, 2009, 2010 Free Software Foundation // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -34,7 +34,7 @@ test01() bool test __attribute__((unused)) = true; std::unique_ptr a; - std::shared_ptr p(a); // { dg-error "used here" } + std::shared_ptr p(a); // { dg-error "cannot bind" } return 0; } @@ -45,4 +45,4 @@ main() test01(); return 0; } -// { dg-excess-errors "deleted function" } +// { dg-excess-errors "initializing argument" } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc index e5a1073..1813239 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/assign/assign_neg.cc @@ -49,7 +49,7 @@ test03() std::unique_ptr p2 = p1; } -// { dg-error "deleted function" "" { target *-*-* } 354 } +// { dg-error "deleted function" "" { target *-*-* } 348 } // { dg-error "used here" "" { target *-*-* } 42 } // { dg-error "no matching" "" { target *-*-* } 48 } // { dg-warning "candidates are" "" { target *-*-* } 115 } @@ -57,5 +57,5 @@ test03() // { dg-warning "note" "" { target *-*-* } 103 } // { dg-warning "note" "" { target *-*-* } 98 } // { dg-warning "note" "" { target *-*-* } 92 } -// { dg-error "deleted function" "" { target *-*-* } 209 } +// { dg-error "deleted function" "" { target *-*-* } 210 } // { dg-error "used here" "" { target *-*-* } 49 } diff --git a/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc index d4c2b3a..61b7ae9 100644 --- a/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc +++ b/libstdc++-v3/testsuite/20_util/unique_ptr/modifiers/reset_neg.cc @@ -36,4 +36,4 @@ void test01() } // { dg-error "used here" "" { target *-*-* } 35 } -// { dg-error "deleted function" "" { target *-*-* } 344 } +// { dg-error "deleted function" "" { target *-*-* } 338 } -- 2.7.4