aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorPaolo Carlini <pcarlini@suse.de>2006-09-24 19:42:34 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2006-09-24 19:42:34 +0000
commitc8bd30ddb32028f9e61eea0293ef5eca55093c76 (patch)
tree65129d2ef631e22884afdbfafd2befca2efa8c89 /libstdc++-v3/testsuite
parentaf17634547724868eb034351d63f2e29cce4d7b3 (diff)
downloadgcc-c8bd30ddb32028f9e61eea0293ef5eca55093c76.zip
gcc-c8bd30ddb32028f9e61eea0293ef5eca55093c76.tar.gz
gcc-c8bd30ddb32028f9e61eea0293ef5eca55093c76.tar.bz2
boost_shared_ptr.h (shared_ptr<>::shared_ptr(const __shared_ptr<>&), [...]): Remove.
2006-09-24 Paolo Carlini <pcarlini@suse.de> * include/tr1/boost_shared_ptr.h (shared_ptr<>::shared_ptr(const __shared_ptr<>&), shared_ptr(const __weak_ptr<>&), shared_ptr(const __shared_ptr<>&, __static_cast_tag), shared_ptr(const __shared_ptr<>&, __const_cast_tag), shared_ptr(const __shared_ptr<>&, __dynamic_cast_tag), weak_ptr<>::weak_ptr(const __shared_ptr<>&), weak_ptr(const __weak_ptr<>&)): Remove. (shared_ptr<>::shared_ptr(const shared_ptr<>&), shared_ptr(const weak_ptr<>&), shared_ptr(const shared_ptr<>&, __static_cast_tag), shared_ptr(const shared_ptr<>&, __const_cast_tag), shared_ptr(const shared_ptr<>&, __dynamic_cast_tag), static_pointer_cast(const shared_ptr<>&), const_pointer_cast(const shared_ptr<>&), dynamic_pointer_cast(const shared_ptr<>&), weak_ptr<>::weak_ptr(const shared_ptr<>&), weak_ptr(const weak_ptr<>&), weak_ptr<>::lock(), __enable_shared_from_this_helper(const __shared_count<>&, const enable_shared_from_this<>*, const _Tp2*)): Add. (class enable_shared_from_this): Add. * testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/ 1.cc: New. * testsuite/tr1/2_general_utilities/memory/shared_ptr/casts/1.cc: Likewise. * testsuite/tr1/2_general_utilities/memory/weak_ptr/lock/1.cc: Likewise. * include/tr1/boost_shared_ptr.h: Further formatting and uglification fixes. From-SVN: r117184
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/1.cc39
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/casts/1.cc46
-rw-r--r--libstdc++-v3/testsuite/tr1/2_general_utilities/memory/weak_ptr/lock/1.cc36
3 files changed, 121 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/1.cc
new file mode 100644
index 0000000..2d1ebad
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/enable_shared_from_this/1.cc
@@ -0,0 +1,39 @@
+// 2006-09-24 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006 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.
+
+// 2.2.5 Template class enable_shared_from_this [tr.util.smartptr.enab]
+
+#include <tr1/memory>
+#include <testsuite_tr1.h>
+
+// { dg-do compile }
+
+struct X : public std::tr1::enable_shared_from_this<X>
+{
+};
+
+int main()
+{
+ using __gnu_test::check_ret_type;
+ using std::tr1::shared_ptr;
+
+ shared_ptr<X> spx(new X);
+ check_ret_type<shared_ptr<X> >(spx->shared_from_this());
+}
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/casts/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/casts/1.cc
new file mode 100644
index 0000000..8851f25
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/shared_ptr/casts/1.cc
@@ -0,0 +1,46 @@
+// 2006-09-24 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006 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.3.9 shared_ptr casts [tr.util.smartptr.shared.cast]
+
+#include <tr1/memory>
+#include <testsuite_tr1.h>
+
+// { dg-do compile }
+
+struct MyP { virtual ~MyP() { }; };
+struct MyDP : MyP { };
+
+int main()
+{
+ using __gnu_test::check_ret_type;
+ using std::tr1::shared_ptr;
+ using std::tr1::static_pointer_cast;
+ using std::tr1::const_pointer_cast;
+ using std::tr1::dynamic_pointer_cast;
+
+ shared_ptr<double> spd;
+ shared_ptr<const int> spci;
+ shared_ptr<MyP> spa;
+
+ check_ret_type<shared_ptr<void> >(static_pointer_cast<void>(spd));
+ check_ret_type<shared_ptr<int> >(const_pointer_cast<int>(spci));
+ check_ret_type<shared_ptr<MyDP> >(static_pointer_cast<MyDP>(spa));
+}
diff --git a/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/weak_ptr/lock/1.cc b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/weak_ptr/lock/1.cc
new file mode 100644
index 0000000..0367b31
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/2_general_utilities/memory/weak_ptr/lock/1.cc
@@ -0,0 +1,36 @@
+// 2006-09-24 Paolo Carlini <pcarlini@suse.de>
+
+// Copyright (C) 2006 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.4 Template class weak_ptr [tr.util.smartptr.weak]
+
+#include <tr1/memory>
+#include <testsuite_tr1.h>
+
+// { dg-do compile }
+
+int main()
+{
+ using __gnu_test::check_ret_type;
+ using std::tr1::weak_ptr;
+ using std::tr1::shared_ptr;
+
+ weak_ptr<int> wp;
+ check_ret_type<shared_ptr<int> >(wp.lock());
+}