summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-16 02:48:06 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-03-16 02:48:06 +0000
commitdaf81a9011692e3ed26192fe397ea5673686a1f0 (patch)
tree46b4804fbfae19bc420f6e418eaca811c77bfad1 /libstdc++-v3/testsuite
parent6d69ecbaa530ba98e81b38d911912b56257f3bdb (diff)
downloadgcc-daf81a9011692e3ed26192fe397ea5673686a1f0.tar.gz
PR libstdc++/56492
* include/std/future (__future_base::_Result): Add result_type typedef. (__future_base::_S_allocate_result): Overload for std::allocator. (__future_base::_Task_setter): Use _Result::result_type instead of deducing the type from the task. (__future_base::_Task_state): Store allocator to allow shared state to be reset. Replace std::function with member of target object type accessed via ... (__future_base::_Task_state_base): New abstract base class. (__future_base::_Task_state_base::_M_run): New virtual function to invoke type-erased target object. (__future_base::_Task_state_base::_M_reset): New virtual function to create new shared_state using same target object and allocator. (__future_base::__create_task_state): Allocate a new _Task_state. (packaged_task::packaged_task): Use __create_task_state. (packaged_task::reset): Use _Task_state_base::_M_reset. * testsuite/30_threads/packaged_task/cons/56492.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@196695 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc
new file mode 100644
index 00000000000..02296bb5aa6
--- /dev/null
+++ b/libstdc++-v3/testsuite/30_threads/packaged_task/cons/56492.cc
@@ -0,0 +1,35 @@
+// { dg-do compile { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++11 -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++11 -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++11 " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2013 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/>.
+
+#include <future>
+
+struct S
+{
+ S() = default;
+ S(S&&) = default;
+ void operator()() { }
+};
+
+std::packaged_task<void ()> pt{ S{} };