Odin
Odin copied to clipboard
Compiler crash when casting slice to relative slice
- Operating System & Odin Version: Windows x64,
odin.exe version dev-2022-03:bff5a67f
package test
import "core:fmt"
main :: proc() {
Slice16 :: #relative(u16) []byte
a := [4]byte{1, 2, 3, 4}
s := cast(Slice16) a[:]
fmt.println(s)
}
test.main
lb_emit_conv: src -> dst
Not Identical []u8 != #relative(u16) []u8
Not Identical []u8 != #relative(u16) []u8
Not Identical 138f31a8890 != 138f0b3ff10
Not Identical 138f31a8890 != 138f0b3ff10
src\llvm_backend_expr.cpp(2127): Panic: Invalid type conversion: '[]u8' to '#relative(u16) []u8' for procedure 'test.main'
Note: cast(#relative(u16) []byte) a[:] fails with an Expected a type, got #relative(u16)[]byte compiler error.
Hello!
I am marking this issue as stale as it has not received any engagement from the community or maintainers 120 days. That does not imply that the issue has no merit! If you feel strongly about this issue
- open a PR referencing and resolving the issue;
- leave a comment on it and discuss ideas how you could contribute towards resolving it;
- leave a comment and describe in detail why this issue is critical for your use case;
- open a new issue with updated details and a plan on resolving the issue.
The motivation for this automation is to help prioritize issues in the backlog and not ignore, reject, or belittle anyone..