Opened 6 years ago
Closed 6 years ago
#12488 closed Bugs (fixed)
read_string_while duplicates character
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | Boost 1.63.0 | Component: | multiprecision |
Version: | Boost 1.62.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Streaming, e.g. "1W" into a multiprecision number will correctly recognize 1, but the first character after the number will be duplicated (from "1W", "WW" is left in the stream).
The cause is the line
is.rdbuf()->sputbackc(static_cast<char>(c));
in read_string_while. The character c does not have to be put back, because snextc first advances position, then returns the character at new position.
Attachments (1)
Change History (3)
by , 6 years ago
comment:1 by , 6 years ago
Provided test file. Result:
$ g++ -o test test.cc -lmpfr
$ ./test
1.0X
1,'XX'
$
Bug is present in 1.62.0, too.
comment:2 by , 6 years ago
Milestone: | To Be Determined → Boost 1.63.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Version: | Boost 1.61.0 → Boost 1.62.0 |
Fixed in https://github.com/boostorg/multiprecision/commit/1c2ecb6f6ec024d3b7901a50caeab706eda4225f.
Note that I generally need to do a lot more work on the iostream operators.
Test