This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
from_chars should not parse "0b" base prefixesSection: 28.2.3 [charconv.from.chars] Status: New Submitter: Jan Schultke Opened: 2025-10-20 Last modified: 2025-10-25
Priority: Not Prioritized
View other active issues in [charconv.from.chars].
View all other issues in [charconv.from.chars].
View all issues with New status.
Discussion:
C23 added support for the "0b" and "0B" base prefix to strtol, and since the wording of
from_chars for integers is based on strol, this inadvertently added support for parsing
"0b" prefixes to from_chars.
Proposed resolution:
This wording is relative to N5014.
Modify 28.2.3 [charconv.from.chars] as indicated:
constexpr from_chars_result from_chars(const char* first, const char* last, integer-type& value, int base = 10);-2- Preconditions:
-3- Effects: The pattern is the expected form of the subject sequence in the "C" locale for the given nonzero base, as described forbasehas a value between 2 and 36 (inclusive).strtol, except that no"0b"or"0B"prefix shall appear if the value ofbaseis 2, no"0x"or"0X"prefix shall appear if the value ofbaseis 16, and except that'-'is the only sign that may appear, and only ifvaluehas a signed type. -4- Throws: Nothing.