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

Compiler crashes on an array of values with different types, which has "using" #3973

Open
greenya opened this issue Jul 24, 2024 · 0 comments

Comments

@greenya
Copy link
Contributor

greenya commented Jul 24, 2024

Context

odin report output:

    Odin:    dev-2024-07-nightly:fc2e31f
    OS:      Windows 11 Home Basic (version: 23H2), build 22631.3880
    CPU:     AMD Ryzen 7 5700X 8-Core Processor
    RAM:     32688 MiB
    Backend: LLVM 18.1.8

Expected Behavior

Compiler should not crash. This code has error which should be reported by the compiler. Basically, it seems it forgets to check allowed types of items provided for array initialization; maybe this has something to do with "using", because as soon as I remove it, compiler see each struct as separate type and correctly tells error. My view is:
image

Current Behavior

Compiler ends with Segmentation fault error code
image

Also tested on macOS (it prints an assertion failed check)
image

Failure Information (for bugs)

Steps to Reproduce

The following code reproduces the issue:

package main

import "core:fmt"

Tile :: struct {
    name: string,
}

TileGround :: struct {
    using tile: Tile,
    some_ground_prop: int,
}

TileTree :: struct {
    using tile: Tile,
    some_tree_prop: int,
}

main :: proc() {
    tiles := []Tile {
        Tile {},
        TileGround { name="green grass", some_ground_prop=7 },
        TileTree { name="tall tree", some_tree_prop=9 },
    }

    fmt.println(tiles)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants