[PATCH] libstdc++: add a constexpr macro for C++26
Jakub Jelinek
jakub@redhat.com
Wed Jan 8 10:49:24 GMT 2025
On Wed, Jan 08, 2025 at 11:44:50AM +0100, Giuseppe D'Angelo wrote:
> The attached patch adds _GLIBCXX26_CONSTEXPR, in preparation for adding
> `constexpr` on some functions starting in C++26.
>
> Thanks,
> --
> Giuseppe D'Angelo
> From 61115549376a29558eb7753f525daf671c6da929 Mon Sep 17 00:00:00 2001
> From: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
> Date: Wed, 1 Jan 2025 12:12:29 +0100
> Subject: [PATCH] libstdc++: add a constexpr macro for C++26
>
> Following the precedent of _GLIBCXX20_CONSTEXPR.
> It will be used to decorate some functions which have been made
> constexpr in C++26 (for instance P2562R1, and maybe P3508R0, P3369R0,
> ...).
>
> libstdc++-v3/ChangeLog:
>
> * include/bits/c++config: Added the
> _GLIBCXX26_CONSTEXPR macro.
>
> Signed-off-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
> ---
> libstdc++-v3/include/bits/c++config | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/libstdc++-v3/include/bits/c++config b/libstdc++-v3/include/bits/c++config
> index a5001d0a0b0..7dc07a77c84 100644
> --- a/libstdc++-v3/include/bits/c++config
> +++ b/libstdc++-v3/include/bits/c++config
> @@ -222,6 +222,14 @@
> # endif
> #endif
>
> +#ifndef _GLIBCXX26_CONSTEXPR
> +# if __cplusplus >= 202303L
Shouldn't that be 202400L instead? I mean that is what
-std=c++26/-std=gnu++26 predefines and has been historically what we've been
using for next version.
I think clang++ also predefines 202400L.
Jakub
More information about the Libstdc++
mailing list