[PATCH] libstdc++: Export apply_result, is_applicable, and is_nothrow_applicable from std module
Jakub Jelinek
jakub@redhat.com
Mon Nov 2 16:57:25 GMT 2026
On Thu, Oct 29, 2026 at 05:53:49PM +0100, Tomasz Kamiński wrote:
> This implements C++26 paper: P1317R2, "Remove return type deduction
> in std::apply".
>
> The traits are implemented in terms of __(noexcept_)?unpack_tuple_like_v
> machinery, in consequence the definitions of corresponding primary templates
> are moved to <type_traits>. Partial specializations remain defined in
> bits/stl_pair.h and bits/range_utils.h, i.e. with of before definitions
> of corresponding types, which guarantees that they are visible at point
> of instantiation depending on them.
>
> While query trait is_applicable, is_nothrow_applicable could be expressed
> in terms of __(noexcept_)?unpack_tuple_like_v that produces boolean value,
> apply_result requires unpacking tuple to invoke_result. To handle above,
> __unpack_tuple_like_impl is introduced, whose value is object of trait
> type (false_type for non tuple like), and thus does not require presence
> of value member.
Thanks for working on this.
This patch regresses
FAIL: g++.dg/plugin/std-module-exports-c++26.C -fplugin=./std_module_exports_plugin.so (test for excess errors)
FAIL: g++.dg/plugin/std-module-exports-c++29.C -fplugin=./std_module_exports_plugin.so (test for excess errors)
Here is an incremental fix for that, tested on x86_64-linux,
ok for trunk if this series is approved?
2026-11-02 Jakub Jelinek <jakub@redhat.com>
* src/c++23/std.cc.in (std::apply_result, std::apply_result_t,
std::is_applicable, std::is_applicable_v, std::is_nothrow_applicable,
std::is_nothrow_applicable_v): New exports for C++26.
--- a/libstdc++-v3/src/c++23/std.cc.in 2026-10-14 11:17:48.208100670 +0200
+++ b/libstdc++-v3/src/c++23/std.cc.in 2026-11-02 17:40:18.478850112 +0100
@@ -3626,6 +3626,14 @@ export namespace std
#if __cpp_lib_within_lifetime >= 202306L
using std::is_within_lifetime;
#endif
+#if __cpp_lib_apply >= 202506L
+ using std::apply_result;
+ using std::apply_result_t;
+ using std::is_applicable;
+ using std::is_applicable_v;
+ using std::is_nothrow_applicable;
+ using std::is_nothrow_applicable_v;
+#endif
}
// <typeindex>
Jakub
More information about the Libstdc++
mailing list