Issue |
127963
|
Summary |
Clang modules cannot compile most recent Windows SDK header
|
Labels |
clang
|
Assignees |
|
Reporter |
kamrann
|
Recently Microsoft appears to have made `10.0.26100.0` the default version of the SDK. A change to `wchar.h` in this version has broken projects that were previously compiling successfully with clang on Windows with C++20 modules enabled.
Simple repro:
```
// repro.mxx
module;
#include <cwchar>
export module repro;
export inline wchar_t const* func()
{
return wmemchr(L"x", L'x', 1);
}
```
```
// source.cxx
import repro;
#include <cwchar>
```
Output:
```
In file included from C:\Code\build2-test-projects\hello\hello\clang\source.cxx:4:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.44.34823\include\cwchar:12:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:209:31: error: redefinition of '_Avx2WmemEnabledWeakValue'
209 | __declspec(selectany) int _Avx2WmemEnabledWeakValue = 0;
| ^
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt\wchar.h:209:31: note: previous definition is here
209 | __declspec(selectany) int _Avx2WmemEnabledWeakValue = 0;
| ^
1 error generated.
```
The issue seems to relate to handling of the Microsoft-specific `__declspec(selectany)`.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs