Skip to content

Commit 18000fe

Browse files
committed
[clang][Interp][NFC] Reject non-floating CK_FloatingCast casts
We need the types to be floating types. Rejecting the HLSL vector casts here is also what the current interpreter does.
1 parent 2d38bec commit 18000fe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) {
176176
}
177177

178178
case CK_FloatingCast: {
179+
// HLSL uses CK_FloatingCast to cast between vectors.
180+
if (!SubExpr->getType()->isFloatingType() ||
181+
!CE->getType()->isFloatingType())
182+
return false;
179183
if (DiscardResult)
180184
return this->discard(SubExpr);
181185
if (!this->visit(SubExpr))

0 commit comments

Comments
 (0)