gcc/libstdc++-v3/testsuite/30_threads
Jonathan Wakely d49b342694 PR libstdc++/84535 constrain std::thread constructor
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
2018-05-03 15:08:36 +01:00
..
async PR libstdc++/84532 prevent unwrapping of reference_wrapper arguments 2018-02-23 23:23:43 +00:00
call_once Update copyright years. 2018-01-03 11:03:58 +01:00
condition_variable Update copyright years. 2018-01-03 11:03:58 +01:00
condition_variable_any Update copyright years. 2018-01-03 11:03:58 +01:00
future Update copyright years. 2018-01-03 11:03:58 +01:00
headers Update copyright years. 2018-01-03 11:03:58 +01:00
lock Update copyright years. 2018-01-03 11:03:58 +01:00
lock_guard Update copyright years. 2018-01-03 11:03:58 +01:00
mutex Update copyright years. 2018-01-03 11:03:58 +01:00
once_flag/cons Update copyright years. 2018-01-03 11:03:58 +01:00
packaged_task Update copyright years. 2018-01-03 11:03:58 +01:00
promise Update copyright years. 2018-01-03 11:03:58 +01:00
recursive_mutex Update copyright years. 2018-01-03 11:03:58 +01:00
recursive_timed_mutex Update copyright years. 2018-01-03 11:03:58 +01:00
scoped_lock Update copyright years. 2018-01-03 11:03:58 +01:00
shared_future Update copyright years. 2018-01-03 11:03:58 +01:00
shared_lock Update copyright years. 2018-01-03 11:03:58 +01:00
shared_mutex Update copyright years. 2018-01-03 11:03:58 +01:00
shared_timed_mutex Update copyright years. 2018-01-03 11:03:58 +01:00
this_thread Update copyright years. 2018-01-03 11:03:58 +01:00
thread PR libstdc++/84535 constrain std::thread constructor 2018-05-03 15:08:36 +01:00
timed_mutex Update copyright years. 2018-01-03 11:03:58 +01:00
try_lock Update copyright years. 2018-01-03 11:03:58 +01:00
unique_lock Update copyright years. 2018-01-03 11:03:58 +01:00