<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60597>60597</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Should `num_get::do_get` accept `"inf"` and `"nan"`?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          frederick-vs-ja
      </td>
    </tr>
</table>

<pre>
    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).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMVVFv6yYU_jX4BTXCEBz7wQ9tI99Vqq6mtdJ9jDAcYu4IWIDT5t9PkNybZtOkTaq0SUnsfIbP3zl85xwRo9k7gB7xB8S3lVjS5EOvAygIRv5-d4x330U1enXqH5cQwCV7wtaMEtGH8tlEjBoSk0LsHrF7txx2e0jnP8qX-4Zgf4RgvVARax-wtl4k4_Z49sYlnE4zRCykhDlhOYkgZ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