Section: 126.96.36.199.2 [facet.num.get.virtuals] Status: CD1 Submitter: Matt Austern Opened: 2000-03-14 Last modified: 2016-02-10
Priority: Not Prioritized
View all other issues in [facet.num.get.virtuals].
View all issues with CD1 status.
Stage 2 processing of numeric conversion is broken.
Table 55 in 188.8.131.52.2 says that when basefield is 0 the integral conversion specifier is %i. A %i specifier determines a number's base by its prefix (0 for octal, 0x for hex), so the intention is clearly that a 0x prefix is allowed. Paragraph 8 in the same section, however, describes very precisely how characters are processed. (It must be done "as if" by a specified code fragment.) That description does not allow a 0x prefix to be recognized.
Very roughly, stage 2 processing reads a char_type ct. It converts ct to a char, not by using narrow but by looking it up in a translation table that was created by widening the string literal "0123456789abcdefABCDEF+-". The character "x" is not found in that table, so it can't be recognized by stage 2 processing.
In 184.108.40.206.2 paragraph 8, replace the line:
static const char src = "0123456789abcdefABCDEF+-";
with the line:
static const char src = "0123456789abcdefxABCDEFX+-";
If we're using the technique of widening a string literal, the string literal must contain every character we wish to recognize. This technique has the consequence that alternate representations of digits will not be recognized. This design decision was made deliberately, with full knowledge of that limitation.