From b0b56b43797a82c55e38e091006beb2f12545a06 Mon Sep 17 00:00:00 2001 From: Yin Zhong Date: Thu, 28 Jan 2021 06:58:49 -0800 Subject: [PATCH] fix #2116 (FMT_COMPILE requires exceptions enabled) (#2117) Co-authored-by: summivox --- include/fmt/compile.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index becf0fe0..2421b6f0 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -554,7 +554,7 @@ constexpr auto compile_format_string(S format_str) { using char_type = typename S::char_type; constexpr basic_string_view str = format_str; if constexpr (str[POS] == '{') { - if (POS + 1 == str.size()) + if constexpr (POS + 1 == str.size()) throw format_error("unmatched '{' in format string"); if constexpr (str[POS + 1] == '{') { return parse_tail(make_text(str, POS, 1), format_str); @@ -571,7 +571,7 @@ constexpr auto compile_format_string(S format_str) { return unknown_format(); } } else if constexpr (str[POS] == '}') { - if (POS + 1 == str.size()) + if constexpr (POS + 1 == str.size()) throw format_error("unmatched '}' in format string"); return parse_tail(make_text(str, POS, 1), format_str); } else {