Commit 35c1b99
authored
[MSVC] Fix a warning that is a default-error on modern MSVC (#8488)
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 #84491 parent 42da79c commit 35c1b99
1 file changed
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
576 | 576 | | |
577 | 577 | | |
578 | 578 | | |
579 | | - | |
| 579 | + | |
| 580 | + | |
580 | 581 | | |
581 | 582 | | |
582 | 583 | | |
| |||
0 commit comments