diff options
author | Jonathan Wakely <jwakely.gcc@gmail.com> | 2011-07-09 10:13:01 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2011-07-09 11:13:01 +0100 |
commit | 4880236e3fdcec453e6f5f3ac04ea7dae3d31a8c (patch) | |
tree | 220d98d77838ae389eb4bbbfd1acdd2be8814bea /libstdc++-v3/testsuite/30_threads/packaged_task | |
parent | 4063e61bc63c3803f8ab2d625ebe8432ac06b3da (diff) | |
download | gcc-4880236e3fdcec453e6f5f3ac04ea7dae3d31a8c.zip gcc-4880236e3fdcec453e6f5f3ac04ea7dae3d31a8c.tar.gz gcc-4880236e3fdcec453e6f5f3ac04ea7dae3d31a8c.tar.bz2 |
re PR libstdc++/49668 ([C++0x] std::thread does not forward its args as rvalues)
2011-07-09 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/49668
* include/std/functional (__bind_simple): Define.
* include/std/future (_Task_setter): Parameterize by type of result
pointer instead of state object.
(_S_task_setter): Type deduction helper.
(_Task_state): Use _S_task_setter and __bind_simple.
(_Deferred_state, _Async_state): Store call wrapper directly not as
std::function. Use _S_task_setter and __bind_simple.
(_S_make_deferred_state, _S_make_async_state): Type deduction helpers.
(async): Use new functions and __bind_simple.
* include/std/mutex (call_once): Use __bind_simple.
* include/std/thread (thread): Likewise. Remove unused headers.
* src/thread.cc: Add header.
* testsuite/30_threads/async/49668.cc: New.
* testsuite/30_threads/call_once/49668.cc: New.
* testsuite/30_threads/thread/cons/49668.cc: New.
* testsuite/30_threads/thread/cons/moveable.cc: Remove unused bool.
From-SVN: r176073
Diffstat (limited to 'libstdc++-v3/testsuite/30_threads/packaged_task')
-rw-r--r-- | libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc b/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc new file mode 100644 index 0000000..55a2f07 --- /dev/null +++ b/libstdc++-v3/testsuite/30_threads/packaged_task/49668.cc @@ -0,0 +1,50 @@ +// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options " -std=gnu++0x -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* alpha*-*-osf* mips-sgi-irix6* } } +// { dg-options " -std=gnu++0x -pthreads" { target *-*-solaris* } } +// { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } } +// { dg-require-cstdint "" } +// { dg-require-gthreads "" } + +// Copyright (C) 2011 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> +#include <testsuite_hooks.h> + +struct moveable +{ + moveable() = default; + moveable(moveable&&) = default; +}; + +typedef decltype(std::placeholders::_1) placeholder_type; + +bool f(moveable, placeholder_type) { return true; } + +void test01() +{ + std::packaged_task<bool(moveable, placeholder_type)> p(f); + p(moveable(), std::placeholders::_1); + bool test = p.get_future().get(); + VERIFY( test ); +} + +int main() +{ + test01(); +} |