[PATCH v2] libstdc++: Export std::byteswap from std.cc.in [PR121373]
hexne
printfne@gmail.com
Mon Aug 4 08:14:55 GMT 2025
std::byteswap was added to the <bit> header file in c++23 and has been
implemented, but it was not exported in std.cc.in. Therefore, when
using import std, std::byteswap cannot be used. Exporting it in
std.cc.in can solve this problem.
The new patch uses feature test macros, enabling the successful
compilation of std.cc files under c++20.
Tested on x86_64-linux.
Signed-off-by: hexne <printfne@gmail.com>
diff --git a/libstdc++-v3/src/c++23/std.cc.in b/libstdc++-v3/src/c++23/std.cc.in
index 1c2346b9f63..48dce19d2de 100644
--- a/libstdc++-v3/src/c++23/std.cc.in
+++ b/libstdc++-v3/src/c++23/std.cc.in
@@ -671,6 +671,12 @@ export namespace std
using std::popcount;
using std::rotl;
using std::rotr;
+
+#if __cpp_lib_byteswap
+ using std::byteswap;
+#endif
+
+
}
// 22.9 <bitset>
More information about the Libstdc++
mailing list