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

cgen error when spawn anon functions, with closure parameters and mut ref function parameters #20163

Closed
shove70 opened this issue Dec 13, 2023 · 0 comments · Fixed by #20164
Closed
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@shove70
Copy link
Contributor

shove70 commented Dec 13, 2023

Describe the bug

import net

fn main() {
	mut conn := &net.TcpConn{}
	a := 1

	spawn fn [a] (mut conn net.TcpConn) {
	}(mut conn)
}

Reproduction Steps

/tmp/v_501/a.2665062129621293191.tmp.c:2158:50: error: expected identifier or '('
typedef struct thread_arg___v_void_net__TcpConn* {
                                                 ^
/tmp/v_501/a.2665062129621293191.tmp.c:2161:3: error: must use 'struct' tag to refer to type 'thread_arg___v_void_net__TcpConn'
} thread_arg___v_void_net__TcpConn*;
  ^
  struct 
/tmp/v_501/a.2665062129621293191.tmp.c:2161:36: error: expected identifier or '('
} thread_arg___v_void_net__TcpConn*;
                                   ^
/tmp/v_501/a.2665062129621293191.tmp.c:2162:29: error: expected ';' after top level declarator
 void* __v_void_net__TcpConn*_thread_wrapper(thread_arg___v_void_net__TcpConn* *arg);
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Expected Behavior

compile passed.

Current Behavior

error.

Possible Solution

No response

Additional Information/Context

No response

V version

latest master

Environment details (OS name and version, etc.)

macos, centos8

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@shove70 shove70 added the Bug This tag is applied to issues which reports bugs. label Dec 13, 2023
@shove70 shove70 self-assigned this Dec 13, 2023
shove70 added a commit to shove70/v that referenced this issue Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant