Skip to content

Fix build error with MSVC v141 #4413

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

hirohira9119
Copy link
Contributor

Fixes #4412

@@ -326,8 +326,8 @@ using underlying_t = typename std::underlying_type<T>::type;
template <typename T> using decay_t = typename std::decay<T>::type;
using nullptr_t = decltype(nullptr);

#if FMT_GCC_VERSION && FMT_GCC_VERSION < 500
// A workaround for gcc 4.9 to make void_t work in a SFINAE context.
#if (FMT_GCC_VERSION && FMT_GCC_VERSION < 500) || FMT_MSC_VERSION
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we put more specific MSC version here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The MSC version depends on the Visual Studio version, but not on the platform toolset. For example:

  • Visual Studio 2017 (v141 toolset) -> _MSC_VER == 1916
  • Visual Studio 2022 (v141 toolset) -> _MSC_VER == 1943
  • Visual Studio 2022 (v143 toolset) -> _MSC_VER == 1943

Because of this, we can't accurately detect the scenario where Visual Studio 2022 is used with the v141 toolset by comparing the value of _MSC_VER. Also, I haven't found a preprocessor definition that provides the platform toolset version.

As a result, I've applied this fix to all MSVC compilers.

Copy link
Contributor

@vitaut vitaut Apr 14, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review. I've corrected the formatting. Also, I've updated the comment to be more accurate: MSVC 2017 -> MSVC v141.

@vitaut vitaut merged commit b8192d2 into fmtlib:master Apr 15, 2025
45 checks passed
@vitaut
Copy link
Contributor

vitaut commented Apr 15, 2025

Thank you

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.

Build error with MSVC v141
2 participants