@@ -222,7 +222,8 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
222222 return this ->emitNE (PtrT, CE);
223223 }
224224
225- case CK_IntegralComplexToBoolean: {
225+ case CK_IntegralComplexToBoolean:
226+ case CK_FloatingComplexToBoolean: {
226227 std::optional<PrimType> ElemT =
227228 classifyComplexElementType (SubExpr->getType ());
228229 if (!ElemT)
@@ -237,8 +238,14 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
237238 return false ;
238239 if (!this ->emitLoadPop (*ElemT, CE))
239240 return false ;
240- if (!this ->emitCast (*ElemT, PT_Bool, CE))
241- return false ;
241+ if (*ElemT == PT_Float) {
242+ if (!this ->emitCastFloatingIntegral (PT_Bool, CE))
243+ return false ;
244+ } else {
245+ if (!this ->emitCast (*ElemT, PT_Bool, CE))
246+ return false ;
247+ }
248+
242249 // We now have the bool value of E[0] on the stack.
243250 LabelTy LabelTrue = this ->getLabel ();
244251 if (!this ->jumpTrue (LabelTrue))
@@ -250,8 +257,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
250257 return false ;
251258 if (!this ->emitLoadPop (*ElemT, CE))
252259 return false ;
253- if (!this ->emitCast (*ElemT, PT_Bool, CE))
254- return false ;
260+ if (*ElemT == PT_Float) {
261+ if (!this ->emitCastFloatingIntegral (PT_Bool, CE))
262+ return false ;
263+ } else {
264+ if (!this ->emitCast (*ElemT, PT_Bool, CE))
265+ return false ;
266+ }
255267 // Leave the boolean value of E[1] on the stack.
256268 LabelTy EndLabel = this ->getLabel ();
257269 this ->jump (EndLabel);
0 commit comments