SemaExpr.cpp - use castAs<> instead of getAs<> as we dereference the pointer directly. NFCI.

castAs<> will assert the correct cast type instead of just returning null, which we then try to dereference immediately.
This commit is contained in:
Simon Pilgrim 2020-11-24 17:36:58 +00:00
parent 9d996c01aa
commit 88bb265670
1 changed files with 1 additions and 2 deletions

View File

@ -3778,8 +3778,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
if (Ty == Context.DoubleTy) {
if (getLangOpts().SinglePrecisionConstants) {
const BuiltinType *BTy = Ty->getAs<BuiltinType>();
if (BTy->getKind() != BuiltinType::Float) {
if (Ty->castAs<BuiltinType>()->getKind() != BuiltinType::Float) {
Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).get();
}
} else if (getLangOpts().OpenCL &&