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

Constants of type typeid cannot be used in other constants #4653

Open
tadeohepperle opened this issue Jan 3, 2025 · 0 comments
Open

Constants of type typeid cannot be used in other constants #4653

tadeohepperle opened this issue Jan 3, 2025 · 0 comments

Comments

@tadeohepperle
Copy link
Contributor

Context

        Odin:    dev-2024-12:6e1d02886
        OS:      Manjaro Linux, Linux 6.1.112-1-MANJARO
        CPU:     12th Gen Intel(R) Core(TM) i7-1260P
        RAM:     31806 MiB
        Backend: LLVM 14.0.6

Behavior

typeids cannot be used in struct constants or arrays:

ThreeTypes :: struct {
	a: typeid,
	b: typeid,
	c: typeid,
}
TYPE_1: typeid : int
TYPE_2: typeid : string
THREE_TYPES :: ThreeTypes{TYPE_1, TYPE_2, TYPE_1}

This should work, since TYPE_1 and TYPE_2 are constants, but it does not, instead this error is emitted:
ThreeTypes{TYPE_1, TYPE_2, TYPE_1}' is not a compile-time known constant

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