diff options
author | Jason Merrill <jason@redhat.com> | 2021-10-06 17:12:02 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-10-06 17:14:33 -0400 |
commit | 6aab794614d26007d6886d7440f2e8124a08416a (patch) | |
tree | 0a89e4394ebf1ffd8148297c9e0f094ec4f0f4d1 /gcc | |
parent | 929cb75e4299cb950dd4ac325535662229e37f5c (diff) | |
download | gcc-6aab794614d26007d6886d7440f2e8124a08416a.zip gcc-6aab794614d26007d6886d7440f2e8124a08416a.tar.gz gcc-6aab794614d26007d6886d7440f2e8124a08416a.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/spaceship-synth8a.C | 25 |
1 files changed, 25 insertions, 0 deletions
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 0000000..42a32da --- /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" } |