Only P3068R6 (Allowing exception throwing in constant-evaluation) is implemented in the library so far, so the value of the constexpr_exceptions feature test macro should be 202411L. Once we support the library changes in P3378R2 (constexpr exception types) then we can set the value to 202502L again.
libstdc++-v3/ChangeLog: PR libstdc++/117785 * include/bits/version.def (constexpr_exceptions): Define correct value. * include/bits/version.h: Regenerate. * libsupc++/exception: Check correct value. * testsuite/18_support/exception/version.cc: New test. --- Tested x86_64-linux. Pushed to trunk. libstdc++-v3/include/bits/version.def | 2 +- libstdc++-v3/include/bits/version.h | 4 ++-- libstdc++-v3/libsupc++/exception | 1 + libstdc++-v3/testsuite/18_support/exception/version.cc | 10 ++++++++++ 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 libstdc++-v3/testsuite/18_support/exception/version.cc diff --git a/libstdc++-v3/include/bits/version.def b/libstdc++-v3/include/bits/version.def index df58e7018d81..cf0672b48224 100644 --- a/libstdc++-v3/include/bits/version.def +++ b/libstdc++-v3/include/bits/version.def @@ -2053,7 +2053,7 @@ ftms = { ftms = { name = constexpr_exceptions; values = { - v = 202502; + v = 202411; cxxmin = 26; extra_cond = "__cpp_constexpr_exceptions >= 202411L"; }; diff --git a/libstdc++-v3/include/bits/version.h b/libstdc++-v3/include/bits/version.h index 1414dd78ddab..c01ddf14dd57 100644 --- a/libstdc++-v3/include/bits/version.h +++ b/libstdc++-v3/include/bits/version.h @@ -2301,9 +2301,9 @@ #if !defined(__cpp_lib_constexpr_exceptions) # if (__cplusplus > 202302L) && (__cpp_constexpr_exceptions >= 202411L) -# define __glibcxx_constexpr_exceptions 202502L +# define __glibcxx_constexpr_exceptions 202411L # if defined(__glibcxx_want_all) || defined(__glibcxx_want_constexpr_exceptions) -# define __cpp_lib_constexpr_exceptions 202502L +# define __cpp_lib_constexpr_exceptions 202411L # endif # endif #endif /* !defined(__cpp_lib_constexpr_exceptions) && defined(__glibcxx_want_constexpr_exceptions) */ diff --git a/libstdc++-v3/libsupc++/exception b/libstdc++-v3/libsupc++/exception index 25ce8d97e315..fc6f8d927711 100644 --- a/libstdc++-v3/libsupc++/exception +++ b/libstdc++-v3/libsupc++/exception @@ -38,6 +38,7 @@ #include <bits/exception.h> #define __glibcxx_want_uncaught_exceptions +#define __glibcxx_want_constexpr_exceptions #define __glibcxx_want_exception_ptr_cast #include <bits/version.h> diff --git a/libstdc++-v3/testsuite/18_support/exception/version.cc b/libstdc++-v3/testsuite/18_support/exception/version.cc new file mode 100644 index 000000000000..09a2d102b720 --- /dev/null +++ b/libstdc++-v3/testsuite/18_support/exception/version.cc @@ -0,0 +1,10 @@ +// { dg-do preprocess { target c++26 } } +// { dg-add-options no_pch } + +#include <exception> + +#ifndef __cpp_lib_constexpr_exceptions +# error "Feature test macro for constexpr_exceptions is missing in <exception>" +#elif __cpp_lib_constexpr_exceptions < 202411L +# error "Feature test macro for constexpr_exceptions has wrong value in <exception>" +#endif -- 2.50.1