https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69724
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Tue May 14 12:01:15 2019 New Revision: 271166 URL: https://gcc.gnu.org/viewcvs?rev=271166&root=gcc&view=rev Log: PR libstdc++/69724 avoid temporary in std::thread construction The std::thread constructor creates (and then moves) an unnecessary temporary copy of each argument. Optimize it to only make the one copy that is required. PR libstdc++/69724 * include/std/thread (thread::_State_impl, thread::_S_make_state): Replace single _Callable parameter with variadic _Args pack, to forward them directly to the tuple of decayed copies. * testsuite/30_threads/thread/cons/69724.cc: New test. Added: trunk/libstdc++-v3/testsuite/30_threads/thread/cons/69724.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/std/thread