Skip to content

cgen: unknown type name for a reference to an alias of a fixed array of struct #28029

Description

@rilaaax

Describe the bug

When compiling with -g flag, C compilation fails when using a reference to an alias of a fixed array of struct.

No errors without the flag.

Reproduction Steps

type Palette = [4]Color

enum Color {
	red
	green
	blue
}

struct Box {
	p &Palette
}

fn main() {
	box := Box{
		p: unsafe { nil }
	}
	println(box)
}

Expected Behavior

success

Current Behavior

 error: unknown type name 'main__Palette'
 1556 |         main__Palette* p;
      |         ^
1 error generated.

Possible Solution

No response

Additional Information/Context

No response

V version

0.5.2 a5a89d5

Environment details (OS name and version, etc.)

V full version V 0.5.2 76f77e3.a5a89d5
OS macos, macOS, 27.0, 26A5388g
V git status 0.5.2-210-ga5a89d56
cc version Apple clang version 21.0.0 (clang-2100.1.1.101)
gcc version Apple clang version 21.0.0 (clang-2100.1.1.101)
clang version Apple clang version 21.0.0 (clang-2100.1.1.101)
tcc version tcc version 0.9.28rc 2026-07-24 HEAD@85ba3ae8 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 274abd24
emcc version N/A
glibc version N/A

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

No one assigned

    Labels

    BugThis tag is applied to issues which reports bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions