@@ -222,7 +222,8 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
222
222
return this ->emitNE (PtrT, CE);
223
223
}
224
224
225
- case CK_IntegralComplexToBoolean: {
225
+ case CK_IntegralComplexToBoolean:
226
+ case CK_FloatingComplexToBoolean: {
226
227
std::optional<PrimType> ElemT =
227
228
classifyComplexElementType (SubExpr->getType ());
228
229
if (!ElemT)
@@ -237,8 +238,14 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
237
238
return false ;
238
239
if (!this ->emitLoadPop (*ElemT, CE))
239
240
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
+
242
249
// We now have the bool value of E[0] on the stack.
243
250
LabelTy LabelTrue = this ->getLabel ();
244
251
if (!this ->jumpTrue (LabelTrue))
@@ -250,8 +257,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
250
257
return false ;
251
258
if (!this ->emitLoadPop (*ElemT, CE))
252
259
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
+ }
255
267
// Leave the boolean value of E[1] on the stack.
256
268
LabelTy EndLabel = this ->getLabel ();
257
269
this ->jump (EndLabel);
0 commit comments