The standard requires that the std::thread constructor is constrained so it can't be called with a first argument of type std::thread. The current implementation only meets that requirement if the constructor is called with one argument, by using deleted overloads. This uses an enable_if constraint to enforce the requirement for any number of arguments. Also add a static assertion to give a more readable error for invalid arguments that cannot be invoked. Also simplify _Invoker to reduce the error cascade for ill-formed instantiations with non-invocable arguments. PR libstdc++/84535 * include/std/thread (thread::__not_same): New SFINAE helper. (thread::thread(_Callable&&, _Args&&...)): Add SFINAE constraint that first argument is not a std::thread. Add static assertion to check INVOKE expression is valid. (thread::thread(thread&), thread::thread(const thread&&)): Remove. (thread::_Invoke::_M_invoke, thread::_Invoke::operator()): Use __invoke_result for return types and remove exception specifications. * testsuite/30_threads/thread/cons/84535.cc: New. From-SVN: r259893
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
async | Loading commit data... | |
call_once | Loading commit data... | |
condition_variable | Loading commit data... | |
condition_variable_any | Loading commit data... | |
future | Loading commit data... | |
headers | Loading commit data... | |
lock | Loading commit data... | |
lock_guard | Loading commit data... | |
mutex | Loading commit data... | |
once_flag/cons | Loading commit data... | |
packaged_task | Loading commit data... | |
promise | Loading commit data... | |
recursive_mutex | Loading commit data... | |
recursive_timed_mutex | Loading commit data... | |
scoped_lock | Loading commit data... | |
shared_future | Loading commit data... | |
shared_lock | Loading commit data... | |
shared_mutex | Loading commit data... | |
shared_timed_mutex | Loading commit data... | |
this_thread | Loading commit data... | |
thread | Loading commit data... | |
timed_mutex | Loading commit data... | |
try_lock | Loading commit data... | |
unique_lock | Loading commit data... |