[clang] [clang][Interp] Handle complex values in visitBool() (PR #79452)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 19 08:21:44 PST 2024


================
@@ -2120,8 +2074,15 @@ bool ByteCodeExprGen<Emitter>::visitInitializer(const Expr *E) {
 template <class Emitter>
 bool ByteCodeExprGen<Emitter>::visitBool(const Expr *E) {
   std::optional<PrimType> T = classify(E->getType());
-  if (!T)
+  if (!T) {
+    // Convert complex values to bool.
+    if (E->getType()->isAnyComplexType()) {
+      if (!this->visit(E))
+        return false;
+      return this->emitComplexBoolCast(E);
+    }
----------------
tbaederr wrote:

@AaronBallman probably knows a reason for this.

https://github.com/llvm/llvm-project/pull/79452


More information about the cfe-commits mailing list