[committed] libstdc++: Implement constexpr std::to_chars for C++23 (P2291R3)

Jonathan Wakely jwakely@redhat.com
Mon Oct 17 08:48:41 GMT 2022


On Sat, 15 Oct 2022 at 21:26, Jonathan Wakely via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
> libstdc++-v3/ChangeLog:
>
>         * include/bits/charconv.h (__to_chars_10_impl): Add constexpr
>         for C++23. Remove 'static' from array.
>         * include/std/charconv (__cpp_lib_constexpr_charconv): Define.

I managed to define the feature test macro with the wrong value. Fixed
by the attached patch, pushed to trunk.
-------------- next part --------------
commit 0f4815502d8dac07579dc7a5a40c597a18291b4c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Oct 17 09:38:02 2022

    libstdc++: Fix value of __cpp_lib_constexpr_charconv
    
    libstdc++-v3/ChangeLog:
    
            * include/std/charconv (__cpp_lib_constexpr_charconv): Define to
            correct value.
            * include/std/version (__cpp_lib_constexpr_charconv): Likewise.
            * testsuite/20_util/to_chars/constexpr.cc: Check correct value.
            * testsuite/20_util/to_chars/version.cc: Likewise.

diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv
index 4b6cc83a567..7aefdd3298c 100644
--- a/libstdc++-v3/include/std/charconv
+++ b/libstdc++-v3/include/std/charconv
@@ -51,7 +51,7 @@
 #endif
 
 #if __cplusplus > 202002L
-# define __cpp_lib_constexpr_charconv 202202L
+# define __cpp_lib_constexpr_charconv 202207L
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
diff --git a/libstdc++-v3/include/std/version b/libstdc++-v3/include/std/version
index bec9e7aa792..3c7c440bd80 100644
--- a/libstdc++-v3/include/std/version
+++ b/libstdc++-v3/include/std/version
@@ -302,7 +302,7 @@
 #if __cplusplus > 202002L
 // c++23
 #define __cpp_lib_byteswap 202110L
-#define __cpp_lib_constexpr_charconv 202202L
+#define __cpp_lib_constexpr_charconv 202207L
 #define __cpp_lib_constexpr_typeinfo 202106L
 #if __cpp_concepts >= 202002L
 # define __cpp_lib_expected 202202L
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/constexpr.cc b/libstdc++-v3/testsuite/20_util/to_chars/constexpr.cc
index 30c591659ee..10855b737c7 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/constexpr.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/constexpr.cc
@@ -5,7 +5,7 @@
 
 #ifndef __cpp_lib_constexpr_charconv
 # error "Feature-test macro for constexpr charconv missing in <charconv>"
-#elif __cpp_lib_constexpr_charconv != 202202L
+#elif __cpp_lib_constexpr_charconv != 202207L
 # error "Feature-test macro for constexpr charconv has wrong value in <charconv>"
 #endif
 
diff --git a/libstdc++-v3/testsuite/20_util/to_chars/version.cc b/libstdc++-v3/testsuite/20_util/to_chars/version.cc
index af06e1bf054..25b1e0036e8 100644
--- a/libstdc++-v3/testsuite/20_util/to_chars/version.cc
+++ b/libstdc++-v3/testsuite/20_util/to_chars/version.cc
@@ -11,6 +11,6 @@
 
 #ifndef __cpp_lib_constexpr_charconv
 # error "Feature-test macro for constexpr charconv missing in <version>"
-#elif __cpp_lib_constexpr_charconv != 202202L
+#elif __cpp_lib_constexpr_charconv != 202207L
 # error "Feature-test macro for constexpr charconv has wrong value in <version>"
 #endif


More information about the Libstdc++ mailing list