<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95681>95681</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-cl, mismatch MSVC cl about `error: redefinition of 'XXX' as different kind of symbol`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
lygstate
</td>
</tr>
</table>
<pre>
Code to reproduce the issue
```cpp
#include <windows.h>
DPAPI_IMP
BOOL
WINAPI
wpCryptProtectMemory(
_Inout_ LPVOID pDataIn, // in out data to encrypt
_In_ DWORD cbDataIn, // multiple of CRYPTPROTECTMEMORY_BLOCK_SIZE
_In_ DWORD dwFlags
)
{
return TRUE;
}
namespace test
{
extern "C" __declspec(selectany) void const *const CryptProtectMemory = nullptr;
}
int main()
{
return 0;
}
```
With cl.exe, it's compiles fine.
With clang-cl.exe, it's comes with
```
C:\work\study\runtimes\win-polyfill>clang-cl test.cpp
test.cpp(16,52): error: redefinition of 'CryptProtectMemory' as different kind of symbol
16 | extern "C" __declspec(selectany) void const *const CryptProtectMemory = nullptr;
| ^
C:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um\dpapi.h(312,1): note: previous definition is here
312 | CryptProtectMemory(
| ^
1 error generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VE1v2zgQ_TX0ZRBBoqwPH3RwZBsw2qyNNNu0ezFocmRxS5ECScX1v1_QVhK3TdPbCobFj9GQ896bx5yTB41YkeyWZIsJG3xrbKVOB-eZx8neiFNVG4HgDVjsrREDR_AtgnRuQBIvSDwf__P48uN9P67QVGquBoFA0vootTBHF7UkXV72F9v5dr1b320v09vN5uNl9Lj-a75dX8bHvran3m-t8cj9HXbGnggtL5uwW2sz-B08Px-3nzfrxcsU-gXzbK0JreH6IXRF6AqkBjN4EMyzUCBqHo4aUwOE7LvrzxaPm_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