Skip to content

[MSVC] Fix a warning that is a default-error on modern MSVC#8488

Merged
bob80905 merged 2 commits into
microsoft:mainfrom
bob80905:resolve_clang-cl_compilation_errors
May 29, 2026
Merged

[MSVC] Fix a warning that is a default-error on modern MSVC#8488
bob80905 merged 2 commits into
microsoft:mainfrom
bob80905:resolve_clang-cl_compilation_errors

Conversation

@bob80905
Copy link
Copy Markdown
Collaborator

@bob80905 bob80905 commented May 28, 2026

There are warnings emitted:

C:\actions-runner\_work\offload-test-suite\offload-test-suite\DXC\include\llvm/ADT/StringRef.h(582): error C2220: the following warning is treated  as an error                                                                                                                                         
C:\actions-runner\_work\offload-test-suite\offload-test-suite\DXC\include\llvm/ADT/StringRef.h(582): warning C5285: cannot declare a specialization for 'std::is_nothrow_constructible': Specializing this standard library template is forbidden by N5014 [meta.rqmts]/4                               
C:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\14.51.36231\include\type_traits(1014): note: see declaration of                 'std::is_nothrow_constructible'                                                                                                                     
C:\actions-runner\_work\offload-test-suite\offload-test-suite\DXC\include\llvm/ADT/StringRef.h(582): note: to simplify migration, consider the      temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings              

that can be remedied by guarding the specialization against the MSVC STL version that forbids it.
This PR adds an extra condition (!(defined(_MSVC_STL_UPDATE) && _MSVC_STL_UPDATE >= 202604L)) to skip the std::is_nothrow_constructible specializations on MSVC STL releases that enforce N5014 [meta.rqmts]/4. This is more precise than checking _MSC_VER because the restriction comes from the STL headers, not the compiler itself. Newer STL versions compute the trait correctly without the workaround.

The build fails because /WX treats the warning as an error (C2220).
Assisted by: Github Copilot
Resolves #8449

@bob80905 bob80905 merged commit 35c1b99 into microsoft:main May 29, 2026
14 checks passed
@github-project-automation github-project-automation Bot moved this from New to Done in HLSL Roadmap May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

DXC won't compile now with MSVC build tools v14.51

3 participants