================
@@ -199,6 +199,25 @@ static llvm::APSInt convertBoolVectorToInt(const Pointer
&Val) {
return Result;
}
+static bool CheckFloatResult(InterpState &S, CodePtr OpPC,
+ const APFloat &Result, APFloat::opStatus Status) {
+ if (S.inConstantContext())
+ return true;
+
+ // If any of the following exceptions were raised, the operation is not a
+ // constant expression.
+ if (Status & (APFloat::opInvalidOp | APFloat::opOverflow |
+ APFloat::opUnderflow | APFloat::opDivByZero)) {
+ if (!S.checkingPotentialConstantExpression()) {
+ const SourceInfo &Loc = S.Current->getSource(OpPC);
+ S.CCEDiag(Loc, diag::note_constexpr_float_arithmetic) << Result.isNaN();
----------------
Serosh-commits wrote:
> Minor nit: CheckFloatResult could provide more specific diagnostics about
> which FP exception occurred. This can be deferred to a follow-up PR.
yeah sure i will add up a follow up pr for this thanks
https://github.com/llvm/llvm-project/pull/194327
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits