Closed
Description
// 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)
[...]