@@ -3849,7 +3849,7 @@ static bool handleScalarCast(EvalInfo &Info, const FPOptions FPO, const Expr *E,
38493849 : Info.Ctx.getIntTypeForBitwidth(64, false);
38503850 Result = APValue(Info.Ctx.MakeIntValue(IntResult, IntType));
38513851 }
3852- if (DestTy->isFloatingType ()) {
3852+ if (DestTy->isRealFloatingType ()) {
38533853 APValue Result2 = APValue(APFloat(0.0));
38543854 if (!HandleIntToFloatCast(Info, E, FPO,
38553855 Info.Ctx.getIntTypeForBitwidth(64, false),
@@ -4048,9 +4048,9 @@ static unsigned elementwiseSize(EvalInfo &Info, QualType BaseTy) {
40484048 if (Type->isConstantArrayType()) {
40494049 QualType ElTy = cast<ConstantArrayType>(Info.Ctx.getAsArrayType(Type))
40504050 ->getElementType();
4051- uint64_t Size =
4051+ uint64_t ArrSize =
40524052 cast<ConstantArrayType>(Info.Ctx.getAsArrayType(Type))->getZExtSize();
4053- for (uint64_t I = 0; I < Size ; ++I) {
4053+ for (uint64_t I = 0; I < ArrSize ; ++I) {
40544054 WorkList.push_back(ElTy);
40554055 }
40564056 continue;
@@ -11239,11 +11239,12 @@ bool RecordExprEvaluator::VisitCastExpr(const CastExpr *E) {
1123911239 return false;
1124011240 }
1124111241
11242+ unsigned NEls = elementwiseSize(Info, E->getType());
1124211243 // flatten the source
1124311244 SmallVector<APValue> SrcEls;
1124411245 SmallVector<QualType> SrcTypes;
1124511246 if (!flattenAPValue(Info.Ctx, Val, SE->getType(), SrcEls, SrcTypes,
11246- UINT_MAX ))
11247+ NEls ))
1124711248 return Error(E);
1124811249
1124911250 // cast the elements and construct our struct result
@@ -13617,11 +13618,12 @@ bool ArrayExprEvaluator::VisitCastExpr(const CastExpr *E) {
1361713618 return false;
1361813619 }
1361913620
13621+ unsigned NEls = elementwiseSize(Info, E->getType());
1362013622 // flatten the source
1362113623 SmallVector<APValue> SrcEls;
1362213624 SmallVector<QualType> SrcTypes;
1362313625 if (!flattenAPValue(Info.Ctx, Val, SE->getType(), SrcEls, SrcTypes,
13624- UINT_MAX ))
13626+ NEls ))
1362513627 return Error(E);
1362613628
1362713629 // cast the elements
0 commit comments