File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 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) {
114114 }
115115
116116 case CK_FloatingCast: {
117+ if (DiscardResult)
118+ return this ->discard (SubExpr);
117119 if (!this ->visit (SubExpr))
118120 return false ;
119121 const auto *TargetSemantics = &Ctx.getFloatSemantics (CE->getType ());
120122 return this ->emitCastFP (TargetSemantics, getRoundingMode (CE), CE);
121123 }
122124
123125 case CK_IntegralToFloating: {
126+ if (DiscardResult)
127+ return this ->discard (SubExpr);
124128 std::optional<PrimType> FromT = classify (SubExpr->getType ());
125129 if (!FromT)
126130 return false ;
@@ -135,6 +139,9 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
135139
136140 case CK_FloatingToBoolean:
137141 case CK_FloatingToIntegral: {
142+ if (DiscardResult)
143+ return this ->discard (SubExpr);
144+
138145 std::optional<PrimType> ToT = classify (CE->getType ());
139146
140147 if (!ToT)
Original file line number Diff line number Diff line change @@ -1024,6 +1024,10 @@ namespace DiscardExprs {
10241024 __null;
10251025 __builtin_offsetof (A, a);
10261026 1 ,2 ;
1027+ (int )1.0 ;
1028+ (float )1 ;
1029+ (double )1 .0f ;
1030+ (signed )4u ;
10271031
10281032 return 0 ;
10291033 }
You can’t perform that action at this time.
0 commit comments