Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Error When Using Own Type in Union as `map` Key

Open dozn opened this issue 10 months ago • 1 comments

Context

package main
S :: struct { data: map[U]int }
U :: union { S }

I don't believe we allow the struct itself in which a map is located in to be used as a key, but the union is bypassing the check or something, otherwise it would spit out Invalid type of a key for a map, got 'S'.

Current Behavior

D:\Programming\Odin\src\types.cpp(4133): Assertion Failure: t->Struct.fields.count == 0 || t->Struct.offsets != nullptr

Expected Behavior

No C++ error.


Odin: dev-2025-01:600e0ebed OS: Windows 11 Professional (version: 23H2), build 22631.4602 CPU: AMD Ryzen 7 3700X 8-Core Processor RAM: 65457 MiB Backend: LLVM 18.1.8

dozn avatar Jan 13 '25 05:01 dozn

Still occurs using dev-2025-06:805f7ce97

dozn avatar Jun 06 '25 12:06 dozn