vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.5k stars 2.15k forks source link

Type with reference to itself crashes the compiler #21732

Closed fleximus closed 3 days ago

fleximus commented 3 days ago

Describe the bug

Adding a type with reference to itself will make the compiler crash

Reproduction Steps

type FnType = fn (string) FnType

fn main() {
    println("OK")
}

Expected Behavior

Compile or throw an error

Current Behavior

Segmentation fault (core dumped)

Possible Solution

No response

Additional Information/Context

No response

V version

V 0.4.6 d364e61

Environment details (OS name and version, etc.)

V full version: V 0.4.6 96751ed.d364e61 OS: linux, Linux Mint 21.3

CC version: cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 thirdparty/tcc status: thirdparty-linux-amd64 40e5cbb5

[!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.