From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2122) id 2B55D3858401; Wed, 6 Oct 2021 21:14:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B55D3858401 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jason Merrill To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-4217] c++: One more spaceship test. X-Act-Checkin: gcc X-Git-Author: Jason Merrill X-Git-Refname: refs/heads/master X-Git-Oldrev: 929cb75e4299cb950dd4ac325535662229e37f5c X-Git-Newrev: 6aab794614d26007d6886d7440f2e8124a08416a Message-Id: <20211006211444.2B55D3858401@sourceware.org> Date: Wed, 6 Oct 2021 21:14:44 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Oct 2021 21:14:44 -0000 https://gcc.gnu.org/g:6aab794614d26007d6886d7440f2e8124a08416a commit r12-4217-g6aab794614d26007d6886d7440f2e8124a08416a Author: Jason Merrill Date: Wed Oct 6 17:12:02 2021 -0400 c++: One more spaceship test. Jakub suggested adding a variant where we actually try to call the implicitly deleted operator. gcc/testsuite/ChangeLog: * g++.dg/cpp2a/spaceship-synth8a.C: New test. Diff: --- gcc/testsuite/g++.dg/cpp2a/spaceship-synth8a.C | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8a.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8a.C new file mode 100644 index 00000000000..42a32da77f9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-synth8a.C @@ -0,0 +1,25 @@ +// PR c++/94907 +// { dg-do compile { target c++20 } } + +namespace std { struct strong_ordering { + int _v; + constexpr strong_ordering (int v) :_v(v) {} + constexpr operator int (void) const { return _v; } + static const strong_ordering less; + static const strong_ordering equal; + static const strong_ordering greater; +}; +constexpr strong_ordering strong_ordering::less = -1; +constexpr strong_ordering strong_ordering::equal = 0; +constexpr strong_ordering strong_ordering::greater = 1; +} + +struct E; +struct D { + virtual std::strong_ordering operator<=>(const struct E&) const = 0; +}; +struct E : D { // { dg-error "no match" } + std::strong_ordering operator<=>(const E&) const override = default; // { dg-message "default" } +}; + +auto x = E() <=> E(); // { dg-error "deleted" }