Skip to content
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

Bad codegen when casting procs #5901

Closed
yglukhov opened this issue May 28, 2017 · 0 comments · Fixed by #23683
Closed

Bad codegen when casting procs #5901

yglukhov opened this issue May 28, 2017 · 0 comments · Fixed by #23683

Comments

@yglukhov
Copy link
Member

proc foo() {.importc.}
(cast[proc(a: int) {.cdecl.}](foo))(5)
Error: execution of an external compiler program 'clang -c  -w  -I/Users/yglukhov/Projects/nim/lib -o /Users/yglukhov/nimcache/test2.o /Users/yglukhov/nimcache/test2.c' failed with exit code: 1

/Users/yglukhov/nimcache/test2.c:94:6: error: too many arguments to function call, expected 0, have 1
        foo(((NI) 5));
        ~~~ ^~~~~~~~
/Users/yglukhov/nimcache/test2.c:13:11: note: 'foo' declared here
N_NIMCALL(void, foo)(void);
          ^
1 error generated.
Parashurama added a commit to Parashurama/Nim that referenced this issue Aug 20, 2017
@stale stale bot added the stale Staled PR/issues; remove the label after fixing them label Aug 4, 2020
@nim-lang nim-lang deleted a comment from stale bot Oct 5, 2021
@stale stale bot removed the stale Staled PR/issues; remove the label after fixing them label Oct 5, 2021
Araq pushed a commit that referenced this issue Jun 5, 2024
…23683)

follow up #6265

fixes #5901
fixes #21211

It causes many problems with gcc14 if we fold the cast function types.
Let's check what it will break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants