Open
Description
Code to reproduce the issue
#include <windows.h>
namespace test
{
extern "C" __declspec(selectany) void const *const CryptProtectMemory = nullptr;
}
int main()
{
return 0;
}
With cl.exe, it's compiles fine.
C:\work\study\runtimes\win-polyfill>cl test.cpp
用于 x64 的 Microsoft (R) C/C++ 优化编译器 19.40.33811 版
版权所有(C) Microsoft Corporation。保留所有权利。
test.cpp
Microsoft (R) Incremental Linker Version 14.40.33811.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:test.exe
test.obj
C:\work\study\runtimes\win-polyfill>
With clang-cl.exe, it's fails with
C:\work\study\runtimes\win-polyfill>clang-cl test.cpp
test.cpp(5,52): error: redefinition of 'CryptProtectMemory' as different kind of symbol
5 | 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.