]> git.ipfire.org Git - people/ms/gcc.git/commit
libstdc++: Fix for explicit copy ctors in <thread> and <future> [PR106695]
authorJonathan Wakely <jwakely@redhat.com>
Mon, 22 Aug 2022 14:42:17 +0000 (15:42 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Mon, 22 Aug 2022 21:52:24 +0000 (22:52 +0100)
commit5abe0657553580bd1b7488dd84d55138a8d9f23c
treea5841e9abbf074b0f1cd9dd4f9ed57e048a3fd9d
parent1b09eea33f2bf9d1eae73b25cc25efb05ea1dc3f
libstdc++: Fix for explicit copy ctors in <thread> and <future> [PR106695]

When I changed std::thread and std::async to avoid unnecessary move
construction of temporaries, I introduced a regression where types with
an explicit copy constructor could not be passed to std::thread or
std::async. The fix is to add a constructor instead of using aggregate
initialization of an unnamed temporary.

libstdc++-v3/ChangeLog:

PR libstdc++/106695
* include/bits/std_thread.h (thread::_State_impl): Forward
individual arguments to _Invoker constructor.
(thread::_Invoker): Add constructor. Delete copies.
* include/std/future (__future_base::_Deferred_state): Forward
individual arguments to _Invoker constructor.
(__future_base::_Async_state_impl): Likewise.
* testsuite/30_threads/async/106695.cc: New test.
* testsuite/30_threads/thread/106695.cc: New test.
libstdc++-v3/include/bits/std_thread.h
libstdc++-v3/include/std/future
libstdc++-v3/testsuite/30_threads/async/106695.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/thread/106695.cc [new file with mode: 0644]