This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On 8/1/19 6:56 AM, Jonathan Wakely wrote:
On 31/07/19 10:50 -0400, Ed Smith-Rowland via libstdc++ wrote:
Here is the patch for

* Implement C++20 p0202 - Add constexpr Modifiers to Functions in <algorithm> and <utility> Headers.

* Implement C++20 p1023 - constexpr comparison operators for std::array.

Relative to the last effort it is rebased on more recent trunk and I added to <version>.

There's some chance that I'll have to tweak the macros after the draft comes in but I'd like to get this moving.?? I've got other chunks of constexpr lib coming.?? This passes C++20 testing onx86_64-linux.

Ok?

Calls to the new __memmove and __memcmp functions need to be qualified
with std:: to prevent ADL. I think we should rename those functions,
but that can happen later.

IMHO, these concepts are too important to leave as an implementation detail.

I suspect the committee will come crawling back to specify these with real names.

memory_copy, memory_compare, memory_move for C++23 anyone?

The new 23_containers/array/comparison_operators/constexpr.cc test
will be UNSUPPORTED by default because it doesn't have the directive
{ dg-options "-std=gnu++2a" }.

The change to the <version> header defines __cpp_lib_constexpr instead
of __cpp_lib_constexpr_algorithms as it should be. For some recent
changes I've added a testcase that does nothing but include <version>
and check the feature test macro, which ensures that it's set
correctly by <version> not just by the other header(s) defining it.
For example, see testsuite/26_numerics/numbers/2.cc added yesterday.
I'll add a testcase.
I wonder if the feature test macro should only be defined when
__cpp_lib_is_constant_evaluated is defined, because otherwise some
algos will not be usable constant expressions (e.g. when compiled with
Clang 7.0).
We can do this later if we need to.

OK for trunk with:

- std:: qualification on the new __mem* functions;
Done.
- the dg-options added to the testcase;
Done.
- fix the macro in <version> (and ideally add a test for it).
Done.
Thanks.

Committed with 273975.?? Final patch and CL attached.

Regards,

Ed


Attachment: CL_constexpr_lib
Description: Text document

Attachment: patch_constexpr_lib_4.bz2
Description: application/bzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]