dotnet / dotnet/csharpstandard
12.20 Any caveats around constant evaluation?
- Dominant language
- C#
- Stars
- 815
- Forks
- 99
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 16
Description
> The compile-time evaluation of constant expressions uses the same rules as run-time evaluation of non-constant expressions, except that where run-time evaluation would have thrown an exception, compile-time evaluation causes a compile-time error to occur.
I know this wasn't the case pre-Roslyn for `decimal`, as the implementation of `decimal` arithmetic had very slightly different rules to the CLR. (I can dig up the connect issue if necessary.)
I'm wondering whether there are other things we need to be aware of, such as the use of 80-bit arithmetic, different types of signalling NaN etc (probably not the latter, given the lack of expression evaluation). Worth asking wiser heads.
Contributor guide
Assessment
This issue has not been assessed yet.