Skip to content

cgen error for cb1 := fn (){}; cb2 := &cb1; cb3 := &cb2; println(voidptr(cb3)) #24537

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

Open
spytheman opened this issue May 21, 2025 · 2 comments
Labels
Bug This tag is applied to issues which reports bugs. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.

Comments

@spytheman
Copy link
Member

spytheman commented May 21, 2025

V version: V 0.4.10 4dc3465, press to see full `v doctor` output
V full version V 0.4.10 d6031ba.4dc3465
OS linux, Ubuntu 20.04.6 LTS
Processor 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-3225 CPU @ 3.30GHz
Memory 0.73GB/15.05GB
V executable /home/delian/v/v
V last modified time 2025-05-20 13:50:06
V home dir OK, value: /home/delian/v
VMODULES OK, value: /home/delian/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/delian/v
env VFLAGS "-no-parallel"
Git version git version 2.49.0
V git status weekly.2025.21
.git/config present true
cc version cc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
gcc version gcc (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.0
clang version clang version 10.0.0-4ubuntu1
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (Ubuntu GLIBC 2.31-0ubuntu9.16) 2.31

What did you do?
./v -g -o vdbg cmd/v && ./vdbg cb_addresses.v && cb_addresses

const hello = 'hello world!'
fn main() {
        cb1 := fn () string {
                return hello
        }
        cb2 := &cb1
        cb3 := &cb2
		println(voidptr(cb1))
		println(voidptr(cb2))
		println(voidptr(cb3))
}

What did you see?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/cb_addresses.01JVRDPXHQJ2YTG352RPK55PCE.tmp.c:1955: error: expression expected before ')'
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).

What did you expect to see?

a compiled program

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.

@spytheman spytheman added Bug This tag is applied to issues which reports bugs. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. labels May 21, 2025
Copy link

Connected to Huly®: V_0.6-22904

@spytheman
Copy link
Member Author

On a side note - v reduce is amazing.

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. Unit: cgen Bugs/feature requests, that are related to the default C generating backend. Unit: Compiler Bugs/feature requests, that are related to the V compiler in general.
Projects
None yet
Development

No branches or pull requests

1 participant