mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
Workaround a bug in MSVC's constexpr handling
This commit is contained in:
parent
b8f85f671f
commit
62616b88a6
@ -3024,7 +3024,11 @@ constexpr unsigned parse_nonnegative_int(Iterator &it) {
|
|||||||
assert('0' <= *it && *it <= '9');
|
assert('0' <= *it && *it <= '9');
|
||||||
unsigned value = 0;
|
unsigned value = 0;
|
||||||
do {
|
do {
|
||||||
unsigned new_value = value * 10 + (*it++ - '0');
|
unsigned new_value = value * 10 + (*it - '0');
|
||||||
|
// Workaround for MSVC "setup_exception stack overflow" error:
|
||||||
|
auto next = it;
|
||||||
|
++next;
|
||||||
|
it = next;
|
||||||
// Check if value wrapped around.
|
// Check if value wrapped around.
|
||||||
if (new_value < value) {
|
if (new_value < value) {
|
||||||
value = (std::numeric_limits<unsigned>::max)();
|
value = (std::numeric_limits<unsigned>::max)();
|
||||||
|
Loading…
Reference in New Issue
Block a user