Fix build with MSVC C++20 modules (#3254)

When using fmt with C++20 modules under MSVC, it can end up requiring certain things to have storage that would not otherwise have needed to. Since I didn't see anything that was already doing detection for `inline constexpr` variable support, I've just moved the entire thing into the only function where it's used.
This commit is contained in:
Orvid King 2022-12-28 19:58:57 -08:00 committed by GitHub
parent 9e60304869
commit 7e5a959564
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,9 +395,9 @@ FMT_CONSTEXPR auto to_unsigned(Int value) ->
return static_cast<typename std::make_unsigned<Int>::type>(value);
}
FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7";
FMT_CONSTEXPR inline auto is_utf8() -> bool {
FMT_MSC_WARNING(suppress : 4566) constexpr unsigned char section[] = "\u00A7";
constexpr auto is_utf8() -> bool {
// Avoid buggy sign extensions in MSVC's constant evaluation mode (#2297).
using uchar = unsigned char;
return FMT_UNICODE || (sizeof(section) == 3 && uchar(section[0]) == 0xC2 &&