[committed] libstdc++: Define __cpp_lib_constexpr_string macro

Jonathan Wakely jwakely@redhat.com
Fri Apr 30 21:27:46 GMT 2021

On 28/04/21 16:14 +0100, Jonathan Wakely wrote:
>As noted in r11-1339-gb6ab9ecd550227684643b41e9e33a4d3466724d8 we define
>a non-standard __cpp_lib_constexpr_char_traits feature test macro to
>indicate support for P0426R1 and P1032R1. At some point last year the
>__cpp_lib_constexpr_string macro was retconned to indicate support for
>those papers. This adds the new macro (which we didn't previously
>define, because it referred to P0980R1 "Making std::string constexpr"
>which we don't support).
>	* include/bits/basic_string.h (__cpp_lib_constexpr_string): Define.
>	* include/std/version (__cpp_lib_constexpr_string): Define.
>	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++17.cc:
>	Check for __cpp_lib_constexpr_string.
>	* testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc:
>	Likewise.
>	* testsuite/21_strings/char_traits/requirements/version.cc: New test.

I messed up the __cpp_lib_constexpr_string macro by copy&pasting from
the __cpp_lib_constexpr_char_traits one, which is defined inside a
#ifdef __cplusplus >= 201702 block. But for __cpp_lib_constexpr_string
it isn't so the #else means that we define it to 201811L for
everything newer *or* older than C++17.

I also noticed that __cpp_lib_semaphore wasn't defined consistently,
as it's failing on AIX.

Fixed on trunk by this patch. Tested x86_64-linux and powerpc-aix.

I'll backport this to the relevant branches too.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1628 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210430/6df77d50/attachment-0001.bin>

More information about the Libstdc++ mailing list