diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index 0b519a61ef871..4625374cc4c4f 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -1536,8 +1536,8 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S, return Stmt::BinaryOperatorClass; case OO_Spaceship: - // FIXME: Update this once we support <=> expressions. - llvm_unreachable("<=> expressions not supported yet"); + BinaryOp = BO_Cmp; + return Stmt::BinaryOperatorClass; case OO_AmpAmp: BinaryOp = BO_LAnd; diff --git a/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp b/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp index eb1480ce6102b..29ae95066e27a 100644 --- a/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp +++ b/clang/test/SemaCXX/cxx2a-three-way-comparison.cpp @@ -1,5 +1,14 @@ // RUN: %clang_cc1 -std=c++2a -verify %s +// Keep this test before any declarations of operator<=>. +namespace PR44786 { + template void f(decltype(T{} <=> T{})) {} // expected-note {{previous}} + + struct S {}; + int operator<=>(S const &, S const &); + template void f(decltype(T{} <=> T{})) {} // expected-error {{redefinition}} +} + struct A {}; constexpr int operator<=>(A a, A b) { return 42; } static_assert(operator<=>(A(), A()) == 42);