summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-11 20:10:20 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-11 20:10:20 +0000
commitb297d58a98b1bd7bb2961b51ea311e1e7ff79375 (patch)
tree66be469ca67cbc445b69264429468ad6ce65ffb3 /libstdc++-v3
parent2c5cdc405b013bfaa69eb12f23c1d8391826dc3c (diff)
downloadppe42-gcc-b297d58a98b1bd7bb2961b51ea311e1e7ff79375.tar.gz
ppe42-gcc-b297d58a98b1bd7bb2961b51ea311e1e7ff79375.zip
2005-11-11 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/24799 * include/tr1/functional (hash): Inherit from std::unary_function. * testsuite/tr1/6_containers/unordered/hash/24799.cc: New. PR libstdc++/24805 * include/tr1/boost_shared_ptr.h (swap(shared_ptr<>&, shared_ptr<>&), swap(weak_ptr<>&, weak_ptr<>&)): Move inside namespace tr1. * testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/ 24805.cc: New. PR libstdc++/24809 * include/tr1/type_traits (__is_polymorhpic_helper): Adjust destructor. * testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/ 24809.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106796 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog17
-rw-r--r--libstdc++-v3/include/tr1/boost_shared_ptr.h36
-rw-r--r--libstdc++-v3/include/tr1/functional9
-rw-r--r--libstdc++-v3/include/tr1/type_traits2
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/24805.cc30
-rw-r--r--libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/24809.cc27
-rw-r--r--libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/24799.cc74
7 files changed, 169 insertions, 26 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 1e03518357e..7e7f137a474 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,20 @@
+2005-11-11 Paolo Carlini <pcarlini@suse.de>
+
+ PR libstdc++/24799
+ * include/tr1/functional (hash): Inherit from std::unary_function.
+ * testsuite/tr1/6_containers/unordered/hash/24799.cc: New.
+
+ PR libstdc++/24805
+ * include/tr1/boost_shared_ptr.h (swap(shared_ptr<>&, shared_ptr<>&),
+ swap(weak_ptr<>&, weak_ptr<>&)): Move inside namespace tr1.
+ * testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/
+ 24805.cc: New.
+
+ PR libstdc++/24809
+ * include/tr1/type_traits (__is_polymorhpic_helper): Adjust destructor.
+ * testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/
+ 24809.cc: New.
+
2005-11-10 Paolo Carlini <pcarlini@suse.de>
* testsuite/tr1/2_general_utilities/memory/
diff --git a/libstdc++-v3/include/tr1/boost_shared_ptr.h b/libstdc++-v3/include/tr1/boost_shared_ptr.h
index 2c3e27ca537..ec940a9c25f 100644
--- a/libstdc++-v3/include/tr1/boost_shared_ptr.h
+++ b/libstdc++-v3/include/tr1/boost_shared_ptr.h
@@ -705,8 +705,13 @@ template<typename _Tp>
shared_count _M_refcount; // reference counter
}; // shared_ptr
-// 2.2.3.9 shared_ptr casts
+// 2.2.3.8 shared_ptr specialized algorithms.
+template<typename _Tp>
+ inline void
+ swap(shared_ptr<_Tp>& __a, shared_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+// 2.2.3.9 shared_ptr casts
/** @warning The seemingly equivalent
* <code>shared_ptr<T>(static_cast<T*>(r.get()))</code>
* will eventually result in undefined behaviour,
@@ -902,6 +907,12 @@ template<typename _Tp>
}; // weak_ptr
+// 2.2.4.7 weak_ptr specialized algorithms.
+template<typename _Tp>
+ void
+ swap(weak_ptr<_Tp>& __a, weak_ptr<_Tp>& __b)
+ { __a.swap(__b); }
+
template<typename _Tp>
class enable_shared_from_this
@@ -957,29 +968,6 @@ template<typename _Tp>
};
} // namespace tr1
-
-/**
- * @brief std::swap() specialisation for shared_ptr.
- * @relates shared_ptr.
- */
-template<typename _Tp>
- inline void
- swap(tr1::shared_ptr<_Tp>& __a, tr1::shared_ptr<_Tp>& __b)
- {
- __a.swap(__b);
- }
-
-/**
- * @brief std::swap() specialisation for weak_ptr.
- * @relates weak_ptr.
- */
-template<typename _Tp>
- void
- swap(tr1::weak_ptr<_Tp>& __a, tr1::weak_ptr<_Tp>& __b)
- {
- __a.swap(__b);
- }
-
} // namespace std
#endif
diff --git a/libstdc++-v3/include/tr1/functional b/libstdc++-v3/include/tr1/functional
index 905e6cbfb25..9672da8fe7c 100644
--- a/libstdc++-v3/include/tr1/functional
+++ b/libstdc++-v3/include/tr1/functional
@@ -1103,6 +1103,7 @@ namespace tr1
#define tr1_hashtable_define_trivial_hash(T) \
template<> \
struct hash<T> \
+ : public std::unary_function<T, std::size_t> \
{ \
std::size_t \
operator()(T val) const \
@@ -1125,6 +1126,7 @@ namespace tr1
template<typename T>
struct hash<T*>
+ : public std::unary_function<T*, std::size_t>
{
std::size_t
operator()(T* p) const
@@ -1185,7 +1187,8 @@ namespace tr1
// for TR1 .cc files, these should go in one.
template<>
struct hash<std::string>
- {
+ : public std::unary_function<std::string, std::size_t>
+ {
std::size_t
operator()(const std::string& s) const
{ return Fnv_hash<>::hash(s.data(), s.length()); }
@@ -1194,6 +1197,7 @@ namespace tr1
#ifdef _GLIBCXX_USE_WCHAR_T
template<>
struct hash<std::wstring>
+ : public std::unary_function<std::wstring, std::size_t>
{
std::size_t
operator()(const std::wstring& s) const
@@ -1206,6 +1210,7 @@ namespace tr1
template<>
struct hash<float>
+ : public std::unary_function<float, std::size_t>
{
std::size_t
operator()(float fval) const
@@ -1222,6 +1227,7 @@ namespace tr1
template<>
struct hash<double>
+ : public std::unary_function<double, std::size_t>
{
std::size_t
operator()(double dval) const
@@ -1240,6 +1246,7 @@ namespace tr1
// 10 bytes -> 12 bytes) and resort to frexp.
template<>
struct hash<long double>
+ : public std::unary_function<long double, std::size_t>
{
std::size_t
operator()(long double ldval) const
diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits
index 4ef864da415..c89bb8eae78 100644
--- a/libstdc++-v3/include/tr1/type_traits
+++ b/libstdc++-v3/include/tr1/type_traits
@@ -321,7 +321,7 @@ namespace tr1
: public _Up
{
virtual void __dummy();
- virtual ~__second();
+ virtual ~__second() throw();
};
public:
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/24805.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/24805.cc
new file mode 100644
index 00000000000..94824f6167d
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/modifiers/24805.cc
@@ -0,0 +1,30 @@
+// { dg-do compile }
+
+// 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 <tr1/memory>
+
+// 2.2.3.4 shared_ptr modifiers [tr.util.smartptr.shared.mod]
+
+// swap
+
+// libstdc++/24805
+using std::tr1::swap;
diff --git a/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/24809.cc b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/24809.cc
new file mode 100644
index 00000000000..0b8ab0f7167
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/4_metaprogramming/type_properties/is_polymorphic/24809.cc
@@ -0,0 +1,27 @@
+// { dg-do compile }
+
+// Copyright (C) 2005 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
+// 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.
+
+// 4.5.3 Type properties
+
+#include <tr1/type_traits>
+#include <exception>
+
+// libstdc++/24809
+static const bool b = std::tr1::is_polymorphic<std::exception>::value;
diff --git a/libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/24799.cc b/libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/24799.cc
new file mode 100644
index 00000000000..90a336bdf2e
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/6_containers/unordered/hash/24799.cc
@@ -0,0 +1,74 @@
+// 2005-11-11 Paolo Carlini <pcarlini@suse.de>
+//
+// Copyright (C) 2005 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
+// 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.
+
+// 6.3.3 Class template hash
+
+#include <tr1/functional>
+#include <string>
+#include <tr1/type_traits>
+#include <testsuite_tr1.h>
+#include <testsuite_hooks.h>
+
+template<typename T>
+ void
+ do_test()
+ {
+ bool test __attribute__((unused)) = true;
+
+ using std::tr1::is_same;
+ using __gnu_test::test_relationship;
+
+ typedef typename std::tr1::hash<T>::argument_type argument_type;
+ typedef typename std::tr1::hash<T>::result_type result_type;
+
+ VERIFY( (test_relationship<is_same, argument_type, T>(true)) );
+ VERIFY( (test_relationship<is_same, result_type, std::size_t>(true)) );
+ }
+
+// libstdc++/24799
+void test01()
+{
+ do_test<bool>();
+ do_test<char>();
+ do_test<signed char>();
+ do_test<unsigned char>();
+ do_test<short>();
+ do_test<int>();
+ do_test<long>();
+ do_test<unsigned short>();
+ do_test<unsigned int>();
+ do_test<unsigned long>();
+ do_test<int*>();
+ do_test<std::string>();
+ do_test<float>();
+ do_test<double>();
+ do_test<long double>();
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ do_test<wchar_t>();
+ do_test<std::wstring>();
+#endif
+}
+
+int main()
+{
+ test01();
+ return 0;
+}
OpenPOWER on IntegriCloud