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

C error. thread from fn struct variable #18862

Closed
dnkdev opened this issue Jul 14, 2023 · 0 comments · Fixed by #19096
Closed

C error. thread from fn struct variable #18862

dnkdev opened this issue Jul 14, 2023 · 0 comments · Fixed by #19096
Assignees
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@dnkdev
Copy link
Contributor

dnkdev commented Jul 14, 2023

Describe the bug

So this works:

fn do() {
	println('hello')
}

f := do
p := spawn f()
p.wait()

But this doesn't work:
Code: https://vosca.dev/p/0733bbb6d7

struct S1 {
mut:
	func fn ()
}

fn do() {
	println('hello')
}

mut s := S1{}

s.func = do
p := spawn s.func()
p.wait()

Expected Behavior

no c error

Current Behavior

Output:

/tmp/v_60000/code.11089087381689797842.tmp.c:2142: error: field not found: fn
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

Exited with error status 1

Reproduction Steps

.

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.0

Environment details (OS name and version, etc.)

V full version: V 0.4.0 fc4c431.a9a94cf
OS: linux, Ubuntu 22.04.2 LTS
Processor: 2 cpus, 64bit, little endian, Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz

getwd: /home/pmakhnev/playground
vexe: /home/pmakhnev/v/v
vexe mtime: 2023-07-13 18:00:08

vroot: OK, value: /home/pmakhnev/v
VMODULES: OK, value: /root/.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.34.1
Git vroot status: weekly.2023.27-63-ga9a94cfd (5 commit(s) behind V master)
.git/config present: true

CC version: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
@dnkdev dnkdev added the Bug This tag is applied to issues which reports bugs. label Jul 14, 2023
@shove70 shove70 self-assigned this Aug 9, 2023
shove70 added a commit to shove70/v that referenced this issue Aug 9, 2023
shove70 added a commit to shove70/v that referenced this issue Aug 10, 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.

2 participants