From fd1cabe464d7bed9739e7b52ef81eea936646098 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 20 Jan 2020 06:37:14 -0800 Subject: [PATCH] Workaround a bogus MSVC warning --- include/fmt/format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 76e4fac6..cc9e5b4e 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -221,7 +221,7 @@ namespace internal { // A helper function to suppress bogus "conditional expression is constant" // warnings. -template inline T const_check(T value) { return value; } +template FMT_CONSTEXPR T const_check(T value) { return value; } // An equivalent of `*reinterpret_cast(&source)` that doesn't have // undefined behavior (e.g. due to type aliasing). @@ -2348,7 +2348,7 @@ template struct precision_adapter { template FMT_CONSTEXPR const Char* next_code_point(const Char* begin, const Char* end) { - if (sizeof(Char) != 1 || (*begin & 0x80) == 0) return begin + 1; + if (const_check(sizeof(Char) != 1) || (*begin & 0x80) == 0) return begin + 1; do { ++begin; } while (begin != end && (*begin & 0xc0) == 0x80);