-
-
Notifications
You must be signed in to change notification settings - Fork 799
Open
Description
Context
A recursive union type definition causes the compiler to hang indefinitely.
Odin: dev-2025-07:b095dd71c
OS: macOS Sequoia 15.5.0 (build 24F74, kernel 24.5.0)
CPU: Apple M1 Pro
RAM: 16384 MiB
Backend: LLVM 20.1.6
Expected Behavior
odin build .
reports an error if it cannot compile the program.
Current Behavior
odin build .
hangs.
Steps to Reproduce
This reproducer program hangs the compiler.
If you make the Vertex
use an array of pointers, the compilation succeeds.
If you delete the Entity_Tree
symbol (e.g. never give the Tree
a type) compilation succeeds.
package main
Entity :: struct {
x, y: int,
}
Entity_Tree :: Tree(^Entity) // Delete this type instantiation and the compilation works.
Tree :: struct($T: typeid) {
root: Node(T),
}
// A recursive union definition hangs the build.
Node :: union($T: typeid) {
Vertex(T),
Leaf(T),
}
Vertex :: struct($T: typeid) {
parts: [4]Node(T), // Make this an array of pointers, and compilation works.
}
Leaf :: struct($T: typeid) {
value: T,
}
main :: proc() {
}
Metadata
Metadata
Assignees
Labels
No labels