Issue 60597
Summary [libc++] Should `num_get::do_get` accept `"inf"` and `"nan"`?
Labels new issue
Assignees
Reporter frederick-vs-ja
    Currently libc++'s `std::num_get::do_get` overloads for floating point types accept characters `'i'`, `'I'`, `'n'`, and `'N'` during parsing in order to parse `"inf"`, `"nan"`, and variants with uppercase letters.

https://github.com/llvm/llvm-project/blob/af128791464810123bcd60a6d9d0902b5c550aef/libcxx/include/locale#L465

https://github.com/llvm/llvm-project/blob/af128791464810123bcd60a6d9d0902b5c550aef/libcxx/include/locale#L553

https://github.com/llvm/llvm-project/blob/af128791464810123bcd60a6d9d0902b5c550aef/libcxx/src/locale.cpp#L4793

However, [LWG2381](https://cplusplus.github.io/LWG/issue2381) clarified that `'i'`, `'I'`, `'n'`, and `'N'` are not parsed (and hence `"inf"` and `"nan"` are rejected).

I guess `'i'`, `'I'`, `'n'`, and `'N'` should only be accepted in some extension mode (e.g. perhapes when `__STRICT_ANSI__` is not defined?), and `'p'` and `'P'` should be rejected in C++03 mode.

This seems implementable by using different end offset in different modes instead of the fixed 32 (26 in C++03, 28 in C++11 and later, 32 in extension modes).
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to