boostorg / boostorg/multiprecision

Reading from stream strange handling of extra characters

Open
#29 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
265
Forks
128
Avg merge
4h 48m
Merged PRs (30d)
2

Description

```c++
#include
#include

typedef boost::multiprecision::cpp_int I;

int main(){
I i;
std::string s;
std::istringstream is("12+3");
is >> i >> s;
std::cout << i << '\n';
std::cout << s << '\n';
}
```

causes with boost 1.62 (or with a fresh clone):

> terminate called after throwing an instance of 'boost::exception_detail::clone_impl >'
what(): Unexpected character encountered in input.

However, using `int` instead of `I`, I get
12
+3
as expected.
The string "12w3" gives
12
w3
with `int` or `I`, so it looks like the parser in Boost.Multiprecision is confused because `+` can be part of a number but not in that position.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.