Skip to content

Spawning anonymous functions that have no input arguments (example from book: Getting Started with V Programming) fails #24577

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
denise-amiga opened this issue May 25, 2025 · 4 comments · May be fixed by #24580
Assignees
Labels
Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. Status: Has Workaround This issue has workaround. Unit: markused Bugs/feature requests, that are related to the -skip-unused.

Comments

@denise-amiga
Copy link

denise-amiga commented May 25, 2025

V version: V 0.4.10 52c7130, press to see full `v doctor` output
V full version V 0.4.10 22d2d1a.52c7130
OS linux, "Manjaro Linux"
Processor 16 cpus, 64bit, little endian, AMD Ryzen 9 7940HS w/ Radeon 780M Graphics
Memory 13.68GB/30.57GB
V executable /home/pepe/Dev/v/v
V last modified time 2025-05-25 10:55:16
V home dir OK, value: /home/pepe/Dev/v
VMODULES OK, value: /home/pepe/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/pepe/_mysrc/test/vlang
Git version git version 2.49.0
V git status weekly.2025.21-26-g52c7130a
.git/config present true
cc version cc (GCC) 15.1.1 20250425
gcc version gcc (GCC) 15.1.1 20250425
clang version clang version 19.1.7
tcc version tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (x86_64 Linux)
tcc git status thirdparty-linux-amd64 a0799a5b
emcc version N/A
glibc version ldd (GNU libc) 2.41

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

module main

fn main() {
	t := go fn () string {
		return 'hi'
	}()
	x := t.wait()
	println(typeof(x).name) // string
	println(x) // hi
}

What did you see?

Compilation with unknown C compiler
================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/concurrency06.01JW4FBQ8TPYRJTYPD78066AW9.tmp.c:1290: warning: implicit declaration of function '_v_free'
cc: tcc: error: undefined symbol '_v_free'
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error: 
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .

What did you expect to see?
string
hi

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.

Copy link

Connected to Huly®: V_0.6-22942

@JalonSolov
Copy link
Contributor

JalonSolov commented May 25, 2025

Also on Manjaro here, and I get 2 error messages...

/tmp/v_1000/x.01JW4H6S1N8GXSZPJT9QD4J909.tmp.c:1293: warning: implicit declaration of function '_v_free'
/home/jalon/git/v/thirdparty/tcc/lib/libgc.a: error: 'GC_noop1_ptr' defined twice
tcc: error: undefined symbol '_v_free'

@JalonSolov JalonSolov added Bug This tag is applied to issues which reports bugs. Status: Confirmed This bug has been confirmed to be valid by a contributor. labels May 25, 2025
@felipensp felipensp added the Unit: markused Bugs/feature requests, that are related to the -skip-unused. label May 26, 2025
@felipensp
Copy link
Member

As temporary workaround pass -no-skip-unused.

@felipensp felipensp added the Status: Has Workaround This issue has workaround. label May 26, 2025
@felipensp felipensp self-assigned this May 26, 2025
@felipensp felipensp linked a pull request May 26, 2025 that will close this issue
@ctkjose
Copy link
Contributor

ctkjose commented May 26, 2025

Added comments to PR 24580

ctkjose added a commit to ctkjose/vlang that referenced this issue May 26, 2025
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. Status: Confirmed This bug has been confirmed to be valid by a contributor. Status: Has Workaround This issue has workaround. Unit: markused Bugs/feature requests, that are related to the -skip-unused.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants