================ @@ -4117,14 +4117,17 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { } else if (Literal.isFloatingLiteral()) { QualType Ty; if (Literal.isHalf){ - if (getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts())) + if (getLangOpts().HLSL || + getOpenCLOptions().isAvailableOption("cl_khr_fp16", getLangOpts())) Ty = Context.HalfTy; else { Diag(Tok.getLocation(), diag::err_half_const_requires_fp16); return ExprError(); } } else if (Literal.isFloat) Ty = Context.FloatTy; + else if (getLangOpts().HLSL && Literal.isLong) + Ty = Context.DoubleTy; else if (Literal.isLong) Ty = Context.LongDoubleTy; ---------------- bogner wrote:
Probably better to put the HLSL check under the existing `Literal.isLong` check. This better matches the style of the rest of the function and will probably be less error-prone if something changes here in the future. https://github.com/llvm/llvm-project/pull/87270 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits