With my recent upgrade to Mac OS X 10.9 the default standard C++ library changed from libstdc++ to libc++. Since then I observe unexpected behaviour of the stringstream oper
It looks like that libstdc++ is right and libc++ is wrong, according to the 22.4.2.1.2 of the (2011) standard.
At stage 2,
If it [the character - n.m.] is not discarded, then a check is made to determine if c is allowed as the next character of an input field of the conversion specifier returned by Stage 1 ["%g" in this case - n.m.] . If so, it is accumulated.
Since %g
conversion specifier does not admit d
or X
characters, the character is not accumulated. It is not discarded either (only group separator characters can be discarded). Therefore Stage 2 must end at this point.
Then at stage 3 accumulated characters are converted.
It looks like libc++ erroneously accumulates d
and X
at stage 2, then attempts to convert them, and this fails.