[PATCH] D45476: [C++2a] Implement operator<=> CodeGen and ExprConstant

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 4 22:56:07 PDT 2018


rjmccall added inline comments.


================
Comment at: lib/CodeGen/CGExprAgg.cpp:964
+    RHS = CGF.EmitAnyExpr(E->getRHS()).getAggregatePointer();
+    break;
+  case TEK_Complex:
----------------
It looks like we don't actually support any aggregate types here, which I think is fine because comparing those types is only sensible for things like calls.  If you do want to pave the way for that, or (probably more usefully) for supporting complex types, you should make EmitCompare take the operands as RValues and just use EmitAnyExpr here without paying any attention to the evaluation kind.


================
Comment at: lib/CodeGen/CGExprAgg.cpp:1000
+  assert(CmpInfo.Record->isTriviallyCopyable() &&
+         "cannot copy non-trivially copyable aggregate");
+
----------------
This assertion should really be further up in this function, because you're already relying on this quite heavily by this point.


https://reviews.llvm.org/D45476





More information about the cfe-commits mailing list