From 2747345455a558f5ac0c6742e219715b062d19a9 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 1 Nov 2005 11:01:40 +0000 Subject: [PATCH] re PR libstdc++/24595 (std::tr1::get_deleter not declared) 2005-11-01 Paolo Carlini PR libstdc++/24595 * include/tr1/boost_shared_ptr.h (shared_ptr<>::get_deleter): Move out of shared_ptr. * testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc: New. From-SVN: r106321 --- libstdc++-v3/ChangeLog | 8 +++++ libstdc++-v3/include/tr1/boost_shared_ptr.h | 27 ++++++++------- .../memory/shared_ptr/misc/24595.cc | 39 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 3781978..8b9d310 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2005-11-01 Paolo Carlini + + PR libstdc++/24595 + * include/tr1/boost_shared_ptr.h (shared_ptr<>::get_deleter): + Move out of shared_ptr. + * testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc: + New. + 2005-10-30 Paolo Carlini PR libstdc++/20213 diff --git a/libstdc++-v3/include/tr1/boost_shared_ptr.h b/libstdc++-v3/include/tr1/boost_shared_ptr.h index 8f95ead..01250aa 100644 --- a/libstdc++-v3/include/tr1/boost_shared_ptr.h +++ b/libstdc++-v3/include/tr1/boost_shared_ptr.h @@ -674,27 +674,20 @@ template _M_refcount.swap(__other._M_refcount); } + void* + _M_get_deleter(const std::type_info& __ti) const + { return _M_refcount.get_deleter(__ti); } + private: template bool _M_less(const shared_ptr<_Tp1>& __rhs) const { return _M_refcount < __rhs._M_refcount; } - void* - _M_get_deleter(const std::type_info& __ti) const - { return _M_refcount.get_deleter(__ti); } - template friend class shared_ptr; template friend class weak_ptr; // friends injected into enclosing namespace and found by ADL: - - // get_deleter (experimental) - template - friend inline _Del* - get_deleter(const shared_ptr& __p) - { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); } - template friend inline bool operator==(const shared_ptr& __a, const shared_ptr<_Tp1>& __b) @@ -752,15 +745,21 @@ template return shared_ptr<_Tp>(__r, __dynamic_cast_tag()); } -// operator<< +// 2.2.3.7 shared_ptr I/O template - std::basic_ostream<_Ch,_Tr>& - operator<<(std::basic_ostream<_Ch,_Tr>& __os, const shared_ptr<_Tp>& __p) + std::basic_ostream<_Ch, _Tr>& + operator<<(std::basic_ostream<_Ch, _Tr>& __os, const shared_ptr<_Tp>& __p) { __os << __p.get(); return __os; } +// 2.2.3.10 shared_ptr get_deleter (experimental) +template + inline _Del* + get_deleter(const shared_ptr<_Tp>& __p) + { return static_cast<_Del*>(__p._M_get_deleter(typeid(_Del))); } + template class weak_ptr diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc new file mode 100644 index 0000000..71cbd0b --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/misc/24595.cc @@ -0,0 +1,39 @@ +// Copyright (C) 2005 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 2, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING. If not, write to the Free +// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +// USA. + +// TR1 2.2.2 Template class shared_ptr [tr.util.smartptr.shared] + +#include +#include + +using std::tr1::get_deleter; + +// libstdc++/24595 +void test01() +{ + bool test __attribute__((unused)) = true; + + std::tr1::shared_ptr sp; + VERIFY( !get_deleter(sp) ); +} + +int main() +{ + test01(); + return 0; +} -- 2.7.4