Open theakman2 opened 2 weeks ago
I started fixing the issue, but it looks like a lot of unit tests need to be updated to check whether finite-math-only is enabled. Unfortunately I don't have enough time to make these changes, but hopefully my fork is helpful if you decide to address this.
Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.
Hmm, maybe. The problem with doing this is you can no-longer round-trip a config document that contains NaN/Inf if you all you're doing is modifying some other non-float field.
The TOML spec mandates that floating points are IEEE 754 format, and the library is already capable of detecting these regardless of the compilers attitude towards them (ref). All that's missing here is the other side of the round-trip.
You can run the following command on the generated all-in-one toml.hpp file using Clang 19.1:
When compiling, you get the following warnings:
Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.