Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error When Using Own Type in Union as map Key #4683

Open
dozn opened this issue Jan 13, 2025 · 0 comments
Open

Error When Using Own Type in Union as map Key #4683

dozn opened this issue Jan 13, 2025 · 0 comments

Comments

@dozn
Copy link
Contributor

dozn commented Jan 13, 2025

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 it 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant