Skip to content

C error: error in conversion #26263

@Linklancien

Description

@Linklancien

Describe the bug

/home/bleiz/v/vlib/rand/rand.v:508: error: cannot convert 'struct _result_main__Condition' to 'struct _result_anon_fn___bool'
builder error:
==================
C error found. It should never happen, when compiling pure V code.

Reproduction Steps

import rand

type Condition = fn () bool

fn main() {
	mut list := []Condition{}
	list = [fn () bool {
		return true
	}]
	println(rand.element[Condition](list) or { panic('Err') })
	println(list)
}

Expected Behavior

This shouldn't cause a C error

Current Behavior

C error

Possible Solution

No response

Additional Information/Context

May be linked to #25949 but seem unlikely

V version

V 0.5.0 b9e9192

Environment details (OS name and version, etc.)

V full version V 0.5.0 967a4a2.b9e9192
OS linux, Linux version 6.17.10-300.fc43.x86_64 (mockbuild@d141cca99f734b1cae70e6bdc560c8b0) (gcc (GCC) 15.2.1 20251111 (Red Hat 15.2.1-4), GNU ld version 2.45.1-1.fc43) #1 SMP PREEMPT_DYNAMIC Mon Dec 1 14:59:36 UTC 2025
Processor 4 cpus, 64bit, little endian, Intel(R) Pentium(R) Gold 7505 @ 2.00GHz
Memory 0.34GB/7.43GB
V executable /home/bleiz/v/v
V last modified time 2026-01-04 18:26:12
V home dir OK, value: /home/bleiz/v
VMODULES OK, value: /home/bleiz/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/bleiz/Documents/Code/Tests
Git version git version 2.52.0
V git status b9e9192
.git/config present true
cc version cc (GCC) 15.2.1 20251111 (Red Hat 15.2.1-4)
gcc version gcc (GCC) 15.2.1 20251111 (Red Hat 15.2.1-4)
clang version clang version 21.1.6 (Fedora 21.1.6-1.fc43)
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 (GNU libc) 2.42

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.Status: ConfirmedThis bug has been confirmed to be valid by a contributor.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions