Skip to content

cgen: using incomplete ?bool type (and possibly index overflow) #20823

Closed
@MCausc78

Description

@MCausc78

Describe the bug

title

Reproduction Steps

struct Undefined {}

type Foo[T] = ?T | Undefined

@[params]
struct Bar {
	x Foo[bool] = Undefined{}
}

fn f(b Bar) {
	dump(b)
}

fn main() {
	f()
	f(x: true)
	f(x: Foo[bool](?bool(none)))
}

Expected Behavior

successful compile

Current Behavior

==================
C:/Users/mclr/AppData/Local/Temp/v_0/test.01HPJCTQEKZCQ7Z3DHNTY0YGSP.tmp.c:497: warning: WINVER redefined
C:/Users/mclr/AppData/Local/Temp/v_0/test.01HPJCTQEKZCQ7Z3DHNTY0YGSP.tmp.c:978: error: field '_bool' has incomplete type
...
==================
(Use `v -cg` to print the entire error message)

builder error:
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.4 ec21663

Environment details (OS name and version, etc.)

V full version: V 0.4.4 57a33c3.ec21663
OS: windows, Microsoft Windows 11 Pro v22000 64-bit
Processor: 12 cpus, 64bit, little endian, 

getwd: D:\Games\Proekti\JS-TS\disjs
vexe: D:\Games\Proekti\V\v\v.exe
vexe mtime: 2024-02-13 23:26:25

vroot: OK, value: D:\Games\Proekti\V\v
VMODULES: OK, value: C:\Users\mclr\.vmodules
VTMP: OK, value: C:\Users\mclr\AppData\Local\Temp\v_0

Git version: git version 2.37.0.windows.1
Git vroot status: weekly.2024.06-68-gec21663f
.git/config present: true

CC version:
thirdparty/tcc status: thirdparty-windows-amd64 a39eb79b

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.Unit: cgenBugs/feature requests, that are related to the default C generating backend.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions