Numeric parsing was getting the wrong answer when faced with very long inputs. This fixes both http://llvm.org/bugs/show_bug.cgi?id=15751 and http://llvm.org/bugs/show_bug.cgi?id=15740

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179556 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-04-15 20:40:06 +00:00
parent 993248935c
commit ae57a1ab1d
2 changed files with 144 additions and 16 deletions

View File

@@ -216,4 +216,16 @@ int main()
assert(err == ios.failbit);
assert(v == INFINITY);
}
{
const char str[] = "304888344611713860501504000000";
std::ios_base::iostate err = ios.goodbit;
v = 0;
input_iterator<const char*> iter =
f.get(input_iterator<const char*>(str),
input_iterator<const char*>(str+sizeof(str)),
ios, err, v);
assert(iter.base() == str+sizeof(str)-1);
assert(err != ios.failbit);
assert(v == 304888344611713860501504000000.0L);
}
}