Jonathan Wakely 901900bc37 libstdc++: Improve diagnostics for std::packaged_task invocable checks
Moving the static_assert that checks is_invocable_r_v into _Task_state
means it is checked when we instantiate that class template.

Replacing the __create_task_state function with a static member function
_Task_state::_S_create ensures we instantiate _Task_state and trigger
the static_assert immediately, not deep inside the implementation of
std::allocate_shared. This results in shorter diagnostics that don't
show deeply-nested template instantiations before the static_assert
failure.

Placing the static_assert at class scope also helps us to fail earlier
than waiting until when the _Task_state::_M_run virtual function is
instantiated. That also makes the diagnostics shorter and easier to read
(although for C++11 and C++14 modes the class-scope static_assert
doesn't check is_invocable_r, so dangling references aren't detected
until _M_run is instantiated).

libstdc++-v3/ChangeLog:

	* include/std/future (__future_base::_Task_state): Check
	invocable requirement here.
	(__future_base::_Task_state::_S_create): New static member
	function.
	(__future_base::_Task_state::_M_reset): Use _S_create.
	(__create_task_state): Remove.
	(packaged_task): Use _Task_state::_S_create instead of
	__create_task_state.
	* testsuite/30_threads/packaged_task/cons/dangling_ref.cc:
	Adjust dg-error patterns.
	* testsuite/30_threads/packaged_task/cons/lwg4154_neg.cc:
	Likewise.

Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
2025-04-25 11:47:12 +01:00
2025-01-02 11:59:57 +01:00
2025-04-16 00:18:18 +00:00
2025-04-25 09:53:35 +02:00
2025-04-02 00:18:25 +00:00
2025-03-30 00:16:46 +00:00
2025-01-02 11:59:57 +01:00
2025-04-17 00:18:03 +00:00
2025-04-11 00:17:32 +00:00
2025-01-02 11:59:57 +01:00
2025-04-25 00:18:00 +00:00
2025-01-02 11:59:57 +01:00
2025-04-22 00:17:26 +00:00
2025-04-23 00:18:18 +00:00
2025-04-25 00:18:00 +00:00
2025-04-01 00:19:09 +00:00
2025-03-30 00:16:46 +00:00
2025-01-03 00:17:15 +00:00
2025-01-02 11:59:57 +01:00
2025-04-13 00:17:09 +00:00
2025-04-10 00:18:06 +00:00
2025-01-07 00:18:08 +00:00
2025-01-02 11:59:57 +01:00
2025-01-02 11:59:57 +01:00
2025-03-07 00:17:19 +00:00
2025-04-23 00:18:18 +00:00

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%