[PATCH] D73637: Fix handling of OO_Spaceship in DecodeOperatorCall

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 30 09:10:08 PST 2020


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73637.241485.patch
Type: text/x-patch
Size: 835 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200130/71c8576b/attachment-0001.bin>


More information about the cfe-commits mailing list