Do not parse sign if a sign is not the next legal character when parsing floating point from an input stream. Fixes http://llvm.org/bugs/show_bug.cgi?id=11871
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150609 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -192,6 +192,18 @@ int main()
|
||||
assert(err == ios.goodbit);
|
||||
assert(v == 123);
|
||||
}
|
||||
{
|
||||
v = -1;
|
||||
const char str[] = "2-";
|
||||
std::ios_base::iostate err = ios.goodbit;
|
||||
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+1);
|
||||
assert(err == ios.goodbit);
|
||||
assert(v == 2);
|
||||
}
|
||||
ios.imbue(std::locale(std::locale(), new my_numpunct));
|
||||
{
|
||||
v = -1;
|
||||
|
@@ -144,6 +144,18 @@ int main()
|
||||
assert(err == ios.goodbit);
|
||||
assert(v == 83);
|
||||
}
|
||||
{
|
||||
const char str[] = "2-";
|
||||
ios.setf(0, ios.basefield);
|
||||
std::ios_base::iostate err = ios.goodbit;
|
||||
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+1);
|
||||
assert(err == ios.goodbit);
|
||||
assert(v == 2);
|
||||
}
|
||||
dec(ios);
|
||||
ios.imbue(std::locale(std::locale(), new my_numpunct));
|
||||
{
|
||||
|
Reference in New Issue
Block a user