-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
[Windows] __cdecl is not equivalent to "default calling convention" anymore #13716
Comments
assigned to @timurrrr |
Any suggestions? |
Let's not go down that road. This needs to be handled in the function-merging logic: it's okay to merge a function with CC_Default with a function with an explicit CC if the default CC for that kind of function is the same as the explicit CC. This is the code at SemaDecl.cpp:1962. If you do this right, you should also get the analogous case with _thiscall on a method (admittedly, it's harder to redeclare those). |
But currently it assumes CC_Default == CC_C which is might not be true for free functions on some archs (right?).
Working on this... |
Patch sent out for review a few days ago, assigning to myself. |
One more thing to fix: $ cat cdecl_pointer.cpp void foo() {} void bar(PTR h) {} int main() { $ clang -c cdecl_pointer.cpp && echo "OK" $ clang -c -Xclang -cxx-abi -Xclang microsoft cdecl_pointer.cpp && echo "OK" || echo "FAIL" |
comment #5 repro is not llvm/llvm-bugzilla-archive#13457 |
s/not/now |
Fixed as of r162639. Good job, Timur. |
mentioned in issue llvm/llvm-bugzilla-archive#13457 |
Extended Description
Looks like my r160121 change has regressed:
$ cat cdecl.cpp
void foo();
void __cdecl foo();
$ clang++ -c cdecl.cpp && echo "OK"
OK
$ clang++ -Xclang -cxx-abi -Xclang microsoft -c cdecl.cpp && echo "OK"
cdecl.cpp:2:14: error: function declared 'cdecl' here was previously declared without calling convention
void __cdecl foo();
^
cdecl.cpp:1:6: note: previous declaration is here
void foo();
^
1 error generated.
$ cl -nologo -c cdecl.cpp && echo "OK"
cdecl.cpp
OK
The text was updated successfully, but these errors were encountered: