Skip to content

C error #23403

Description

@Eliyaan
V version: V 0.4.9 9fc8352, press to see full `v doctor` output
V full version V 0.4.9 6ac1d08.9fc8352
OS linux, "Void Linux"
Processor 4 cpus, 64bit, little endian, Intel(R) Pentium(R) Gold 7505 @ 2.00GHz
Memory 17.37GB/23.16GB
V executable /home/nopana/v/v
V last modified time 2025-01-07 23:24:19
V home dir OK, value: /home/nopana/v
VMODULES OK, value: /home/nopana/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/nopana/projects/notOnlyNots
Git version git version 2.47.1
V git status weekly.2024.52-90-g9fc83526
.git/config present true
cc version cc (GCC) 13.2.0
gcc version gcc (GCC) 13.2.0
clang version N/A
tcc version tcc version 0.9.28rc 2024-07-31 HEAD@1cee0908 (x86_64 Linux)
tcc git status thirdparty-linux-amd64 0134e9b9
emcc version N/A
glibc version ldd (GNU libc) 2.39

What did you do?
./v -g -o vdbg cmd/v && ./vdbg main.v && main
above is the command v bug uses, but I used : v run main.v

import gg

struct App {
mut:
	ctx &gg.Context = unsafe { nil }
}

fn main() {
	mut app := &App{}
	app.ctx = gg.new_context(
		user_data: app
		event_fn:  on_event
	)
}

fn on_event(e &gg.Event, mut app App) {
	_ := match [0, 0]! {
		[0, 1]! {
			0
		}
		else {
			panic('')
		}
	}
}

What did you see?

================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/main.01JH1KEX3FBGZXDNT5792TSTVY.tmp.c:11467: error: expression expected before '{'
=================================================================
(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?

No C error

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.

Metadata

Metadata

Assignees

Labels

BugThis tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.Unit: cgenBugs/feature requests, that are related to the default C generating backend.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions