================
@@ -283,6 +283,28 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const 
CastExpr *CE) {
   case CK_ToVoid:
     return discard(SubExpr);
 
+  case CK_IntegralRealToComplex:
+  case CK_FloatingRealToComplex: {
+    // We're creating a complex value here, so we need to
+    // allocate storage for it.
+    if (!Initializing) {
+      std::optional<unsigned> LocalIndex =
+          allocateLocal(CE, /*IsExtended=*/true);
+      if (!LocalIndex)
+        return false;
+      if (!this->emitGetPtrLocal(*LocalIndex, CE))
+        return false;
+    }
+
+    if (!this->visitArrayElemInit(0, SubExpr))
----------------
tbaederr wrote:

That's just how it works, i.e. in 
https://github.com/llvm/llvm-project/pull/75485/ we return `0` for 
`__imag(primitive)`, so we initialize the imaginary part to `0` here when 
creating a complex number from a primitive.

https://github.com/llvm/llvm-project/pull/75590
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to