Skip to content

compiler bug: error: pointer expected #24622

@keiravillekode

Description

@keiravillekode

Describe the bug

Compiler crash

Reproduction Steps

$ v version
V 0.4.10 21da729
$ v test temp/run_test.v
---- Testing... ----------------------------------------------------------------------------
 FAIL     0.000 ms .../temp/run_test.v
>> compilation failed:
================== C compilation error (from tcc): ==============
cc: .....tmp.c:3088: error: pointer expected
=================================================================
(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

temp/f.v

module main

struct Solution {
}

fn f() !Solution {
	mut solution := ?Solution(none)

	g := fn (mut solution ?Solution) ! {
		solution = Solution {}
	}

	g(mut &solution)!

	return error('')
}

temp/run_test.v

module main

fn test_f() {
	assert f()! == Solution {}
}

Expected Behavior

Helpful message

Current Behavior

Compiler crash

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.10 21da729

Environment details (OS name and version, etc.)

Linux 6.11.0-26-generic #26~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC x86_64

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.Option TypeBugs/feature requests, that are related to `?Type`.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

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions