Section: 184.108.40.206.3 [facet.num.get.virtuals] Status: CD1 Submitter: Matt Austern Opened: 2000-03-14 Last modified: 2016-01-28 10:19:27 UTC
Priority: Not Prioritized
View other active issues in [facet.num.get.virtuals].
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 220.127.116.11.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 18.104.22.168.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.