From 07b007a44a277f7b5cde69f5e54c2be336dfca1b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 9 Nov 2023 16:34:55 -0500 Subject: [PATCH] gcc/testsuite/ChangeLog: To: gcc-patches@gcc.gnu.org * g++.dg/cpp23/explicit-obj-ops-non-mem.h: Add <=> and ->*. --- .../g++.dg/cpp23/explicit-obj-ops-non-mem.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gcc/testsuite/g++.dg/cpp23/explicit-obj-ops-non-mem.h b/gcc/testsuite/g++.dg/cpp23/explicit-obj-ops-non-mem.h index b94e56b1dd6..2a8d46ed2c6 100644 --- a/gcc/testsuite/g++.dg/cpp23/explicit-obj-ops-non-mem.h +++ b/gcc/testsuite/g++.dg/cpp23/explicit-obj-ops-non-mem.h @@ -1,9 +1,6 @@ -// missing test for three-way-compare (I don't know how to write it) -// missing test for ->* (I don't know how to write it) - // tests for ops that must be member functions are seperate -#define MAKE_STRUCT_OPS(TYPE) \ +#define MAKE_STRUCT_OPS(TYPE) \ TYPE operator+=(this TYPE self, int) { return self; } \ TYPE operator-=(this TYPE self, int) { return self; } \ TYPE operator*=(this TYPE self, int) { return self; } \ @@ -39,7 +36,9 @@ TYPE operator>(this TYPE self, int) { return self; } \ TYPE operator<=(this TYPE self, int) { return self; } \ TYPE operator>=(this TYPE self, int) { return self; } \ + TYPE operator<=>(this TYPE self, int) { return self; } \ TYPE operator*(this TYPE self) { return self; } \ + TYPE operator->*(this TYPE self, int) { return self; } \ TYPE operator&(this TYPE self) { return self; } \ TYPE operator,(this TYPE self, int) { return self; } @@ -105,8 +104,10 @@ struct Deduced { template Self&& operator>(this Self&& self, int) { return static_cast(self); } template Self&& operator<=(this Self&& self, int) { return static_cast(self); } template Self&& operator>=(this Self&& self, int) { return static_cast(self); } + template Self&& operator<=>(this Self&& self, int) { return static_cast(self); } template Self&& operator*(this Self&& self) { return static_cast(self); } + template Self&& operator->*(this Self&& self, int) { return static_cast(self); } template Self&& operator&(this Self&& self) { return static_cast(self); } template Self&& operator,(this Self&& self, int) { return static_cast(self); } }; @@ -151,8 +152,10 @@ struct Deduced { (OPERAND) > 0; \ (OPERAND) <= 0; \ (OPERAND) >= 0; \ + (OPERAND) <=> 0; \ \ *(OPERAND); \ + (OPERAND) ->* 0; \ &(OPERAND); \ (OPERAND), 0; @@ -196,7 +199,9 @@ struct Deduced { static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) > 0))); \ static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) <= 0))); \ static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) >= 0))); \ + static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) <=> 0))); \ \ static_assert(__is_same(CORRECT_TYPE, decltype(*(OPERAND)))); \ + static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND) ->* 0))); \ static_assert(__is_same(CORRECT_TYPE, decltype(&(OPERAND)))); \ static_assert(__is_same(CORRECT_TYPE, decltype((OPERAND), 0))); -- 2.39.3