decay
in thread
and packaged_task
Section: 32.4.3.3 [thread.thread.constr], 32.10.10.2 [futures.task.members] Status: C++20 Submitter: Stephan T. Lavavej Opened: 2017-11-17 Last modified: 2021-02-25
Priority: 0
View all other issues in [thread.thread.constr].
View all issues with C++20 status.
Discussion:
Following P0777R1 "Treating Unnecessary decay", more occurrences can be fixed.
When constraints are checking for the same type as thread
or a specialization of packaged_task
,
decaying functions to function pointers and arrays to object pointers can't affect the result.
[28-Nov-2017 Moved to Tentatively Ready after five positive votes on the ML.]
[2018-3-17 Adopted in Jacksonville]
Proposed resolution:
Wording relative to N4700.
Edit 32.4.3.3 [thread.thread.constr] as indicated:
template <class F, class... Args> explicit thread(F&& f, Args&&... args);-3- Requires: […]
-4- Remarks: This constructor shall not participate in overload resolution ifis the same type as
decay_tremove_cvref_t<F>std::thread
.
Edit 32.10.10.2 [futures.task.members] as indicated:
template <class F> packaged_task(F&& f);-2- Requires: […]
-3- Remarks: This constructor shall not participate in overload resolution ifis the same type as
decay_tremove_cvref_t<F>packaged_task<R(ArgTypes...)>
.