-
Notifications
You must be signed in to change notification settings - Fork 13.5k
clang-cl, mismatch MSVC cl about error: redefinition of 'XXX' as different kind of symbol
#95681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Similar to issue #58783. |
yeap, somewhat different, this have namespace and for C++ only, without the namespace, MSVC also have error message |
I think Clang is correct to reject that code, per https://eel.is/c++draft/dcl.link#7 and https://eel.is/c++draft/basic.scope#scope-6: https://godbolt.org/z/nPc5451fv -- they don't declare the same entity and the names conflict. CC @rnk @zmodem for opinions on whether this is behavior we should try to implement for compatibility. My inclination is to not support this construct unless there's a strong need; this feels like a bug more than an intentional behavior (unless I'm missing something). |
I need this to export symbols to generate symbols to override windows sdk API, This is something I needed. I think this can be treat as warning instead of error(so that the warning can be disabled) |
I agree with your inclination, we shouldn't do compatibility workarounds unless it's for code which a user cannot control such as Windows system headers. That doesn't seem to be the case here.
If you just need to generate a symbol with the same name, can't you do it in a file which doesn't include windows.h? |
Yeap, because I am trying to override Windows.h's api, I depends on that :( |
Code to reproduce the issue
With cl.exe, it's compiles fine.
With clang-cl.exe, it's fails with
The text was updated successfully, but these errors were encountered: