sberg updated this revision to Diff 241485. sberg added a comment. Minimal reproducer is
template<typename> struct S; template<typename T> void operator <=>(S<T>, S<T>); template<typename T> void f(T x) { decltype(x <=> x) v; } Added a corresponding test to clang/test/SemaCXX/cxx2a-three-way-comparison.cpp. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D73637/new/ https://reviews.llvm.org/D73637 Files: clang/lib/AST/StmtProfile.cpp clang/test/SemaCXX/cxx2a-three-way-comparison.cpp Index: clang/test/SemaCXX/cxx2a-three-way-comparison.cpp =================================================================== --- clang/test/SemaCXX/cxx2a-three-way-comparison.cpp +++ clang/test/SemaCXX/cxx2a-three-way-comparison.cpp @@ -22,3 +22,5 @@ }; int &r = B().operator<=>(0); + +template<typename T> void f(T x) { decltype(x <=> x) v; } Index: clang/lib/AST/StmtProfile.cpp =================================================================== --- clang/lib/AST/StmtProfile.cpp +++ clang/lib/AST/StmtProfile.cpp @@ -1535,8 +1535,8 @@ 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;
Index: clang/test/SemaCXX/cxx2a-three-way-comparison.cpp =================================================================== --- clang/test/SemaCXX/cxx2a-three-way-comparison.cpp +++ clang/test/SemaCXX/cxx2a-three-way-comparison.cpp @@ -22,3 +22,5 @@ }; int &r = B().operator<=>(0); + +template<typename T> void f(T x) { decltype(x <=> x) v; } Index: clang/lib/AST/StmtProfile.cpp =================================================================== --- clang/lib/AST/StmtProfile.cpp +++ clang/lib/AST/StmtProfile.cpp @@ -1535,8 +1535,8 @@ 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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits