summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/tr1
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-14 23:33:01 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2012-11-14 23:33:01 +0000
commitf5bdb6efb2061fd474c511a1d77977c1fb24fc62 (patch)
tree61c548f3b9eeb6c0a2b15a23e063290fb69cd049 /libstdc++-v3/testsuite/tr1
parent2d68d2ef5ff898a3d34b28d57974c1c524ea3654 (diff)
downloadgcc-f5bdb6efb2061fd474c511a1d77977c1fb24fc62.tar.gz
PR libstdc++/55320
* include/std/functional (function::function(F)): Set _M_manager after operations that could throw. (_Function_base::_Ref_manager::_M_init_functor): Use addressof. * include/tr1/functional (_Function_base::_Ref_manager::_M_init_functor): Use addressof. (_Function_base::_Base_manager::_M_get_pointer): Likewise. * testsuite/20_util/function/cons/55320.cc: New. * testsuite/20_util/function/cons/addressof.cc: New. * testsuite/20_util/function/cons/callable.cc: Remove header. * testsuite/20_util/bind/ref_neg.cc: Adjust dg-error line numbers. * testsuite/tr1/3_function_objects/function/10.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193514 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/tr1')
-rw-r--r--libstdc++-v3/testsuite/tr1/3_function_objects/function/10.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/tr1/3_function_objects/function/10.cc b/libstdc++-v3/testsuite/tr1/3_function_objects/function/10.cc
new file mode 100644
index 00000000000..ca29e3cc3fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/tr1/3_function_objects/function/10.cc
@@ -0,0 +1,41 @@
+// Copyright (C) 2012 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 3, 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 COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++0x" }
+// { dg-do compile }
+
+#include <tr1/functional>
+
+struct F
+{
+ void operator()() { }
+ void operator&() const { }
+};
+
+void test01()
+{
+ F f;
+ std::tr1::function<void()> f1 = f;
+ std::tr1::function<void()> f2 = std::tr1::ref(f);
+}
+
+int main()
+{
+ test01();
+
+ return 0;
+}