Chris Jefferson found a defect in the C++0x working draft by trying to run libc++ against boost. I've submitted an issue to the LWG, and this commit attempts to implement the proposed resolution of that defect report. I'd point to the issue but it hasn't been put into the LWG list yet. The title of the issue will be: Stage 2 accumulate incompatibilty

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127303 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant 2011-03-09 01:03:19 +00:00
parent 8dcad976e0
commit 80586729e4

View File

@ -522,6 +522,12 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
__dc = 0;
return 0;
}
if (__ct == __thousands_sep && __grouping.size() != 0)
{
if (__g_end-__g < __num_get_buf_sz)
@ -532,22 +538,28 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
return 0;
}
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 26)
if (__f >= 24)
return -1;
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
switch (__base)
{
case 8:
case 10:
if (__f >= __base)
return 0;
return -1;
break;
default:
if (__f >= 22)
case 16:
if (__f < 22)
break;
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
{
__dc = 0;
*__a_end++ = __src[__f];
return 0;
break;
}
return -1;
}
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
++__dc;
return 0;
}