forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 345
Fix windows build failures with MSVC #11092
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This fixes the windows build with MSVC.
llvm::has_single_bit and llvm::countr_zero both require that the argument type is unsigned but the default underlying type for enums is int, which causes build errors with MSVC. This fixes the windows build with MSVC. ``` FAILED: tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/BoundsSafetyArgs.cpp.obj C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DCLANG_BUILD_STATIC -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__SHORT_FILE__=\"BoundsSafetyArgs.cpp\" -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\include -IC:\Users\hiroshi\cas\llvm-project\llvm\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -std:c++17 -MD /EHs-c- /GR- /showIncludes /Fotools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\BoundsSafetyArgs.cpp.obj /Fdtools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\ /FS -c C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp(196): error C2672: 'llvm::has_single_bit': no matching overloaded function found C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(147): note: could be 'bool llvm::has_single_bit(T) noexcept' C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp(196): note: 'bool llvm::has_single_bit(T) noexcept': could not deduce template argument for '<unnamed-symbol>' C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(146): note: 'std::enable_if_t<false,void>' : Failed to specialize alias template ``` ``` FAILED: tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/BoundsSafetyArgs.cpp.obj C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DCLANG_BUILD_STATIC -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__SHORT_FILE__=\"BoundsSafetyArgs.cpp\" -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\include -IC:\Users\hiroshi\cas\llvm-project\llvm\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -std:c++17 -MD /EHs-c- /GR- /showIncludes /Fotools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\BoundsSafetyArgs.cpp.obj /Fdtools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\ /FS -c C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(158): error C2338: static_assert failed: 'Only unsigned integral types are allowed.' C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(158): note: the template instantiation context (the oldest one first) is ```
@swift-ci please test |
@swift-ci please clean test Windows platform |
@swift-ci please test |
@swift-ci test llvm |
cachemeifyoucan
approved these changes
Aug 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
This was referenced Aug 5, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Suggestion cannot be applied right now. Please check back later.
No description provided.