File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -114,13 +114,17 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
114
114
}
115
115
116
116
case CK_FloatingCast: {
117
+ if (DiscardResult)
118
+ return this ->discard (SubExpr);
117
119
if (!this ->visit (SubExpr))
118
120
return false ;
119
121
const auto *TargetSemantics = &Ctx.getFloatSemantics (CE->getType ());
120
122
return this ->emitCastFP (TargetSemantics, getRoundingMode (CE), CE);
121
123
}
122
124
123
125
case CK_IntegralToFloating: {
126
+ if (DiscardResult)
127
+ return this ->discard (SubExpr);
124
128
std::optional<PrimType> FromT = classify (SubExpr->getType ());
125
129
if (!FromT)
126
130
return false ;
@@ -135,6 +139,9 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
135
139
136
140
case CK_FloatingToBoolean:
137
141
case CK_FloatingToIntegral: {
142
+ if (DiscardResult)
143
+ return this ->discard (SubExpr);
144
+
138
145
std::optional<PrimType> ToT = classify (CE->getType ());
139
146
140
147
if (!ToT)
Original file line number Diff line number Diff line change @@ -1024,6 +1024,10 @@ namespace DiscardExprs {
1024
1024
__null;
1025
1025
__builtin_offsetof (A, a);
1026
1026
1 ,2 ;
1027
+ (int )1.0 ;
1028
+ (float )1 ;
1029
+ (double )1 .0f ;
1030
+ (signed )4u ;
1027
1031
1028
1032
return 0 ;
1029
1033
}
You can’t perform that action at this time.
0 commit comments