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

Minor unhandled circullar dependency between compile time constants and types #4829

Open
jakubtomsu opened this issue Feb 11, 2025 · 0 comments

Comments

@jakubtomsu
Copy link
Contributor

Context

First of all, this is a very minor issue I ran into only because I'm working on my own compiler and I wanted to see how Odin handles certain dependencies between entities. But it's an issue nonetheless so I'm posting it here anyway.

It seems like the compiler doesn't notice certain dependencies between constants and constants associated with types such as size_of(T)

odin report output:

        Odin:    dev-2025-02:584fdc0d4
        OS:      Windows 10 Professional (version: 22H2), build 19045.5371
        CPU:     Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
        RAM:     32681 MiB
        Backend: LLVM 18.1.8

Current Behavior

The following code sample doesn't notice a dependency between FOO and Foo. I think this should be an error.

FOO :: size_of(Foo)

Foo :: [FOO]i32

main :: proc() {
    fmt.println("size_of", size_of(Foo))
    fmt.println("FOO", FOO)
}

Output is:

size_of 0
FOO 0

This applies to size_of, align_of, len, cap and probably bunch of other things.

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