================
@@ -222,6 +222,8 @@ C23 Feature Support
   the same translation unit but from different types.
 - ``-MG`` now silences the "file not found" errors with ``#embed`` when
   scanning for dependencies and encountering an unknown file. #GH165632
+- Allow NaN in constant expression evaluation to maintain consistency with
----------------
rjmccall wrote:

I agree with Aaron about what the semantics should be for platforms using IEEE 
FP. It is an explicit goal of IEEE FP that arithmetic be well-defined, 
consistent, and portable, and it out of keeping with that for the compiler to 
act like `FLT_MAX + FLT_MAX` does not consistently yield `+Inf` or that `+Inf + 
-Inf` does not consistently yield `NaN`. It might be reasonable to warn about 
non-trivial, non-dependent expressions that always produce an infinity or 
`NaN`, but C++ `constexpr` left that kind of purely local constraint behind a 
long time ago.

I understand that the committee doesn't want to mandate IEEE FP, but the 
committee should not be in the business of blocking reasonable behavior for the 
predominant FP design. Someone porting FP code to a non-IEEE platform is going 
to face much worse problems than a few `constexpr`s potentially breaking.

Allowing it to be implementation-defined would give implementations leeway to 
vary based on things like the active FP exceptions mode.

https://github.com/llvm/llvm-project/pull/167892
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to