libstdc++-v3/ChangeLog:

        * src/c++23/std.compat.cc.in: Only export <stdbit.h> and
        <stdckdint.h> contents for C++26 and later.
---

Tested by compiling and importing both std and std.compat.

 libstdc++-v3/src/c++23/std.compat.cc.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/src/c++23/std.compat.cc.in 
b/libstdc++-v3/src/c++23/std.compat.cc.in
index ba7ed0312ab..344502195b1 100644
--- a/libstdc++-v3/src/c++23/std.compat.cc.in
+++ b/libstdc++-v3/src/c++23/std.compat.cc.in
@@ -21,11 +21,15 @@
 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 // <http://www.gnu.org/licenses/>.
 
+module;
+
+#include <stdbit.h>
+#include <stdckdint.h>
+
 export module std.compat;
 export import std;
 
-#include <stdbit.h>
-
+#ifdef __STDC_VERSION_STDBIT_H__
 // <stdbit.h>
 export
 {
@@ -52,7 +56,9 @@ _GLIBCXX_STDBIT_FUNC(stdc_bit_floor);
 _GLIBCXX_STDBIT_FUNC(stdc_bit_ceil);
 #undef _GLIBCXX_STDBIT_FUNC
 }
+#endif
 
+#ifdef __STDC_VERSION_STDCKDINT_H__
 // <stdckdint.h>
 export
 {
@@ -60,6 +66,7 @@ export
   using __gnu_cxx::ckd_sub;
   using __gnu_cxx::ckd_mul;
 }
+#endif
 
 #define STD_COMPAT 1
 
-- 
2.49.0

Reply via email to