[C++ PATCH] Implement P1946R0 - Allow defaulting comparisons by value

Jakub Jelinek jakub@redhat.com
Mon Nov 11 20:07:00 GMT 2019


On Mon, Nov 11, 2019 at 09:07:08AM +0100, Jakub Jelinek wrote:
> From https://www.reddit.com/r/cpp/comments/dtuov8/201911_belfast_iso_c_committee_trip_report/
> I understood P1946R0 made it into C++20, so here is my attempt at
> implementing it, you had most of it implemented anyway because
> in system headers
>     friend constexpr bool
>     operator==(partial_ordering, partial_ordering) noexcept = default;
> etc. has been already accepted.
> 
> Tested so far with make check-c++-all RUNTESTFLAGS=dg.exp=spaceship*
> and make check-target-libstdc++-v3 RUNTESTFLAGS=conformance.exp=18_support/comparisons/common/1.cc
> Ok for trunk if it passes full bootstrap/regtest?

Bootstrapped/regtested successfully on powerpc64le-linux.

> 2019-11-11  Jakub Jelinek  <jakub@redhat.com>
> 
> 	Implement P1946R0 - Allow defaulting comparisons by value
> 	* method.c (early_check_defaulted_comparison): Remove unused
> 	variable i.  For non-static data members always require argument
> 	type to be const C &, for friends allow either both arguments
> 	to be const C &, or both to be C.
> 
> 	* g++.dg/cpp2a/spaceship-synth1-neg.C: New test.
> 	* g++.dg/cpp2a/spaceship-synth4.C: New test.
> 	* g++.dg/cpp2a/spaceship-synth5.C: New test.

	Jakub



More information about the Gcc-patches mailing list