From 62616b88a66a71423c4a26eecef063020891cd4a Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 19 Oct 2017 06:06:13 -0700 Subject: [PATCH] Workaround a bug in MSVC's constexpr handling --- fmt/format.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fmt/format.h b/fmt/format.h index 800daa95..7110827e 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -3024,7 +3024,11 @@ constexpr unsigned parse_nonnegative_int(Iterator &it) { assert('0' <= *it && *it <= '9'); unsigned value = 0; 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. if (new_value < value) { value = (std::numeric_limits::max)();