[PATCH 1/3] C++20 constexpr lib part 1/3

Jonathan Wakely jwakely@redhat.com
Tue Jul 2 12:11:00 GMT 2019


On 26/06/19 19:13 -0400, Ed Smith-Rowland via libstdc++ wrote:
>Here is the first of three patches for C++20 constexpr library.
>
>?????? Implement C++20 p0202 - Add constexpr Modifiers to Functions in 
><algorithm> and <utility> Headers.
>???? ??Implement C++20 p1023 - constexpr comparison operators for std::array.
>
>I believe I have answered peoples concerns with the last patch 
>attempts [https://gcc.gnu.org/ml/libstdc++/2019-03/msg00132.html].
>
>The patch is large because of test cases but really just boils down to 
>adding constexpr for c++2a.
>
>The patch passes testing for gnu++2a and pre-gnu++2a on x86_64-linux:
>
>$ make check -k -j4
>
>$ make check RUNTESTFLAGS=--target_board=unix/-std=gnu++2a -k -j4
>
>OK for trunk?

One more comment. In <bits/stl_algobase.h> this:

+#if __cplusplus > 201703L \
+    && defined(_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED)
+      if (__builtin_is_constant_evaluated())

can be simplified to just:

#ifdef __cpp_lib_is_constant_evaluated
      if (std::is_constant_evaluated())

The feature test macro is exactly the check we want here.




More information about the Libstdc++ mailing list