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

    <tr>
        <th>Summary</th>
        <td>
            Clang ICE: unexpected rewritten operator form
        </td>
    </tr>

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

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

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

<pre>
    // https://godbolt.org/z/sfGncMs96
#include <compare>
struct S {
    const std::strong_ordering& operator<=>(const S&) const = default;
};
bool test(S s) {
    return s < s;
}

Clang crashes:

unexpected rewritten operator form
UNREACHABLE executed at /root/llvm-project/clang/lib/AST/ExprCXX.cpp:126!
[...]
 #5 0x00007feebd4f9859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00000000035e131a (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35e131a)
 #7 0x0000000006efd280 clang::CXXRewrittenBinaryOperator::getDecomposedForm() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6efd280)
 #8 0x00000000070919c1 clang::Stmt::getBeginLoc() const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x70919c1)
 #9 0x00000000064d8aec clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x64d8aec)
#10 0x000000000669b171 clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&, clang::Sema::NamedReturnInfo const&, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x669b171)
#11 0x00000000066c8a07 clang::Sema::BuildReturnStmt(clang::SourceLocation, clang::Expr*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66c8a07)
#12 0x00000000066ca69f clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*, clang::Scope*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x66ca69f)
#13 0x0000000005e60dd7 clang::Parser::ParseReturnStatement() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5e60dd7)
[...]
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8Vk1v4zYQ_TX0hbAhkfo86CDLVhsg2QRJC-S2oMiRw1YmBZLadfbXF5QU29put4cmNQyb4mjevPdISsOslQcFUKB4i-Ldig3uRZuivHvI83zVaPFaIFIjUuMX53qLaDldHrRodOc22hwQqb8hUtv2F8XvbJ6gYIeCEhEqFe8GARjRiutjzwwgup-i1pmBO_yEUbqdZjDGmGtlHbZO-DLU36TV4bM2AoxUB0QSrHswzGmDaIXozsORbMp6QiRBJJ8xEN1hAS0bOofoXAGlu_O40brDDqxDJHvC1icumBhwg1HYeu7YLiCmwfhbdUwdMDfMvsBozVVsUHDqgTsQ2MBXI50DdaaPW22O032_f3rcl9Wv5fZ2j-EEfPAZzGFEaqO1Q6Tuui_HdW_0H8D9JfdF_bRsEKnLp98Qqfen3lTPzxve94iWoXcinMnE281mg-KZN0aExjg4BUEQpC1AI6I2z-Ics0YbXzQ7I5-y5HMSrTuphtP6oIYpwDdWbxJEtsGJkCzOEckvyMmMPH5oDCEN2Yyp-5G7PvayA7OGU99pA-ZNz5pZC8ZJrezamUH9iUjdSHWRu52-wWmGXdRNr-sm0AqSBXhKHDdS9fz8-LYGW6mYeb0_7yMfP4DbgeemLYjaL43nfN5L7ytg5rcQkF0LSIM8zHl4LeDJHd2Z6hYOUt1q_pEkZw4LkvnC5UhkDPiCJBzZNHoA4zd4pfvXGyWdZJ38xnxZf1ovCecYiL1y0r1OWsaDXC2Q9WA43Go-gyyCJfeTj2DHs15dRfypQKT09zszjA8fUmF_9C__-bsv72TM2TlEaBgsnEvyJkzDnzp3p7_AvXk__874n9gRxOP4cLtRrf6nhCvnPsqmyYWFTeHSJp6xIP2xjO0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