Fix build with Apple libc++ lacking floating-point std::from_chars#1160
Fix build with Apple libc++ lacking floating-point std::from_chars#1160daeho-ro wants to merge 3 commits into
Conversation
The double branch of the XML attribute parser called std::from_chars unconditionally. Apple's libc++ ships integer from_chars but deletes the floating-point overload (and undefines __cpp_lib_to_chars), so this fails to compile on macOS. Guard it like the other numeric conversions and fall back to std::stod under the "C" locale, keeping the strict full-string validation.
|
Thanks for this — the Apple libc++ breakage is real and the fix is correctly scoped (only the floating-point One thing I'd like to sort out before merging, plus a smaller note. 1. The
That means the same XML can make a Script expression / numeric port work on one platform and hit a type-mismatch on the other. A compile-fix shouldn't change runtime semantics on the affected platform, so I'd like the fallback to reject the same inputs 2. The save/set/restore is correct for this thread, but A fully manual Either way, would you mind adding a short comment noting the fallback intentionally mirrors |
|
I will apply the fixes here: #1167 |
Apple's libc++ deletes floating-point
std::from_chars(and undefines__cpp_lib_to_chars), so the unguardeddoubleparse inxml_parsing.cppfails to compile on macOS.
Guard it like the other numeric conversions and fall back to
std::stod,keeping the strict full-string validation. Backward-compatible; compile-only
fix (no unit test).