<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62911>62911</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [C++20] Clang claims that virtual spaceship operator isn't virtual.
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          jensmassberg
      </td>
    </tr>
</table>

<pre>
    For the following code Clang complains that 
"only virtual member functions can be marked 'override'".
However, the member function is virtual.


```
#include <compare>

struct Bar;
struct Foo {
  std::partial_ordering operator<=>(const Foo&) const = default;
  virtual std::partial_ordering operator<=>(const Bar&) const = 0;
};
struct Bar : Foo {
 std::partial_ordering operator<=>(const Bar&) const override = default;
};
```

see https://gcc.godbolt.org/z/nG87MdnMq.

Clang doesn't complain for other virtual comparioson operators:
```
#include <compare>

struct Bar;
struct Foo {
  bool operator==(const Foo&) const = default;
 virtual bool operator==(const Bar&) const = 0;
};
struct Bar : Foo {
  bool operator==(const Bar&) const override = default;
};
```

https://gcc.godbolt.org/z/sqdfhdjef
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VF2PmzoQ_TXDi7WRMyYhPPCQj8u9L_sbrgwegrfGZm2T1fbXVxBCd6Oq6rZbyeLD4HPOzBwdGYI-W6ICNgfYnBI5xNb54ols6GQIFflzUjn1WpTOs9gSa5wx7kXbM6udInY0cnrseiO1DSy2MjLgJ-B7QHTWvLKL9nGQhnXUVeRZM9g6amcDq6VlFbFO-i-kGGDmLuS9VgSYAeLqCvOfe6ELecDjxH-HwnS4Ecz_v7tu-bxmRULb2gyKGIjjKFp6AvHP2yMh-qGO7CA9iMO7rdI5Btm8x1iICsQexL6XPmpp_ndekR8b43ryMjoP4gjiNOLjrnY2TBCAW8CcXd9BnJiiRg4mLmxsadjvMIy67xn4gg3Z6b6qg_QMxP6uus-gvk3zh1W-VXI_pas8ItbG2IdRB5aA5bmuV2enKmfiyvkzYPkVsLT_7rJHZR-f343_akvlKFjALC4GZY3zzMWW_NLlqw20C84uxU2kf91BlXPmTT9P4_qQU24l_AzokwzxIY4_m_yvTD08q6ZVT9QkqhAqF7lMqFhvd2mOfJ2lSVvk6yxNc5XJlHKeKb4hrHPB8y0nueYiS3SBHAXfYMpzxI1Y7ajONs1O5Xytdo3ikHLqpDYrYy7dyJ3oEAYqtpiv14mRFZkwxSaipRc2fQTEMUV9MZ55qIZzgJQbHWL4jhJ1NFPeHgEPgAfksDndgtRI3c0pusRAL2sKre6X9jM92_qWfMngTXHXNx3boVrVrgMsR-759tB790R1BCwnxQGwnCr6FgAA___AkNa2">