Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Triggering Assertion in llvm_backend_stmt.cpp

Open albe194e opened this issue 2 years ago • 1 comments

Context

D:\a\Odin\Odin\src\llvm_backend_stmt.cpp(1467): Assertion Failure: `are_types_identical(e->type, type_deref(value.type))

Found the cause: switch &v in &container.element

When i use v as a pointer it gives me the assertion faliure

Odin: dev-2023-08-nightly:985e4eed OS: Windows 10 Home Basic (version: 22H2), build 19045.3208
CPU: AMD Ryzen 5 3400G with Radeon Vega Graphics RAM: 8128 MiB

Expected Behavior

Expected to give an error message if something was wrong.

Current Behavior

Does not give an error message and the compiler asserts

Failure Information (for bugs)

Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.

Steps to Reproduce

Copy paste this code and run, it gives the assertion faliure


package main;

main :: proc() {
    
    list : [dynamic]u;

    append(&list, test1{});
    append(&list, test2{});

    for &element in list {

        switch &v in &element {

        case test1:
        case test2:
        case:
    }
    }
    
}
test1 :: struct {

}
test2 :: struct{

}

u :: union {

    test1,
    test2
}


albe194e avatar Aug 05 '23 20:08 albe194e