Files
gcc/libstdc++-v3/include
Matthias Kretz 52b44d966e libstdc++: Remove non_type and replace it with constant_wrapper in function_ref
This implements P3948R1: constant_wrapper is the only tool needed
for passing constant expressions via function arguments.

This changes function_ref from nontype_t to constant_wrapper and
implements the ambiguity check (static_asert in function_ref
from constant_wrapper constructor).

In addition to P3948R1 this also includes the (forgotten) deduction
guide changes suggested in the draft PR [1].

[1] https://github.com/cplusplus/draft/pull/8878

libstdc++-v3/ChangeLog:

	* include/bits/funcref_impl.h (function_ref::function_ref):
	Change nontype_t parameter to constant_wrapper, and adjust
	accordingly. Add static_assert detecting ambigous semantics.
	(function_ref::operator=): Detect constant_wrapper rather than
	nontype_t.
	* include/bits/funcwrap.h (function_ref): Change nontype_t
	parameter to constant_wrapper in deduction guides.
	* include/bits/utility.h (std::nontype_t, std::nontype)
	(std::__is_nontype_v): Remove.
	(std::__is_constant_wrapper_v): Define.
	* src/c++23/std.cc.in (std::nontype_t, std::nontype):
	Remove exports.
	* testsuite/20_util/function_ref/cw_cons_neg.cc: New tests
	for ambiguity check.
	* testsuite/20_util/function_ref/assign.cc: Replace nontype_t
	with constant_wrapper and nontype with std::cw.
	* testsuite/20_util/function_ref/call.cc: Likewise.
	* testsuite/20_util/function_ref/cons.cc: Likewise.
	* testsuite/20_util/function_ref/cons_neg.cc: Likewise.
	* testsuite/20_util/function_ref/dangling.cc: Likewise.
	* testsuite/20_util/function_ref/deduction.cc: Likewise.
	* testsuite/20_util/function_ref/mutation.cc: Likewise.

Co-authored-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
2026-04-08 13:22:20 +02:00
..
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00
2026-01-02 09:56:11 +01:00