gh-99191: Use correct check for MSVC C++ version support in _wmimodule.cpp #100381
+5
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
As discussed in #99191 , in PC/_wmimodule.cpp it currently uses the check
#if _MSC_VER >= 1929
to determine if the compiler supports C++20 designated initializers. However, the/std:c++20
flag was only introduced in VS 2019 16.11, but1929
is also the version reported in VS 2019 16.10, which doesn't support that flag. Therefore, the current check will break (resulting in the unsupported C++20 branch being taken and presumably resulting in a compiler error) on VS 16.10 and also if the build is invoked such that\std:c++20
is overridden or not passed.However, we can instead use
_MSVC_LANG >= 202002L
to check whether C++20 or greater is actually being targeted.Fixes #99191