aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-05-03 15:08:36 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-05-03 15:08:36 +0100
commitd49b3426947aa1064d8d224619da66daaf4bfb8a (patch)
treef9749ffd105f6da70ff696ec7a8837ce916d1670 /gcc
parent63f122152f8f6f02cfd19677167f05428c2e7f9a (diff)
downloadgcc-d49b3426947aa1064d8d224619da66daaf4bfb8a.zip
gcc-d49b3426947aa1064d8d224619da66daaf4bfb8a.tar.gz
gcc-d49b3426947aa1064d8d224619da66daaf4bfb8a.tar.bz2
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
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions