[gcc r17-2857] libstdc++: Implement LWG 4440 feature-test macros added to <iosfwd>
Patrick Palka
ppalka@gcc.gnu.org
Fri Jul 31 18:13:56 GMT 2026
https://gcc.gnu.org/g:0cb732698c1cf5b5d7c4e2da64ad506e55fae551
commit r17-2857-g0cb732698c1cf5b5d7c4e2da64ad506e55fae551
Author: Patrick Palka <ppalka@redhat.com>
Date: Fri Jul 31 14:11:42 2026 -0400
libstdc++: Implement LWG 4440 feature-test macros added to <iosfwd>
Note __cpp_lib_char8_t doesn't use the <bits/version.h> mechanism, it's
defined in c++config and thus provided by all headers by default.
libstdc++-v3/ChangeLog:
* include/std/iosfwd: Provide feature-test macros
__cpp_lib_spanstream and __cpp_lib_syncbuf.
* testsuite/27_io/headers/iosfwd/synopsis.cc: Verify values
of these FTMs.
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diff:
---
libstdc++-v3/include/std/iosfwd | 4 ++++
libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc | 12 ++++++++++++
2 files changed, 16 insertions(+)
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index 1d5e684b53bb..511b2f3a23f1 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -39,6 +39,10 @@
#include <bits/requires_hosted.h> // iostreams
+#define __glibcxx_want_spanstream
+#define __glibcxx_want_syncbuf
+#include <bits/version.h>
+
/**
* @defgroup io I/O
*
diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
index 8d9501f42ef4..81b158b81285 100644
--- a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
+++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
@@ -3,6 +3,18 @@
#include <iosfwd>
+#if __cplusplus >= 202002L && __cpp_lib_char8_t != 201907L
+# error "Feature-test macro __cpp_lib_char8_t has wrong value in <iosfwd>"
+#endif
+
+#if __cplusplus >= 202202L && __cpp_lib_spanstream != 202106L
+# error "Feature-test macro __cpp_lib_spanstrean has wrong value in <iosfwd>"
+#endif
+
+#if __cplusplus >= 202002L && __cpp_lib_syncbuf != 201803L
+# error "Feature-test macro __cpp_lib_syncbuf has wrong value in <iosfwd>"
+#endif
+
namespace std
{
// [iosfwd.syn]
More information about the Libstdc++-cvs
mailing list