Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with MSVC C++20 modules #3254

Merged
merged 2 commits into from
Dec 29, 2022
Merged

Fix build with MSVC C++20 modules #3254

merged 2 commits into from
Dec 29, 2022

Conversation

Orvid
Copy link
Contributor

@Orvid Orvid commented Dec 29, 2022

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. I've also swapped the function from constexpr to FMT_CONSTEXPR since it's no longer a simple C++11 constexpr function.

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.
@@ -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 auto is_utf8() -> bool {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need inline here because FMT_CONSTEXPR expands to nothing on compilers that don't support relaxed constexpr.

@vitaut vitaut merged commit 7e5a959 into fmtlib:master Dec 29, 2022
@vitaut
Copy link
Contributor

vitaut commented Dec 29, 2022

Thanks

@Orvid Orvid deleted the patch-1 branch December 29, 2022 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants