-
-
Notifications
You must be signed in to change notification settings - Fork 849
Open
Description
The following code results in a parser error where the builtins 'real' and 'imag' autocast into the wrong data type. The following code produces there error message: Error: '3.2' truncated to 'i8', got 3.200000 fmt.println(i8(real(x) / 3.2)).
package main
import "core:fmt"
main :: proc()
{
x: complex128 = 10
fmt.println(i8(real(x) / 3.2))
}
Note that this doesn't happen with other functions for example the following code produces the expected result
package main
import "core:fmt"
my_func :: proc(x: complex128) -> f64
{
return real(x)
}
main :: proc()
{
x: complex128 = 10
fmt.println(i8(my_func(x) / 3.2))
}
Additional Information:
Odin: dev-2025-11:e5153a937
OS: macOS Tahoe 26.0.1 (build 25A362, kernel 25.0.0)
CPU: Apple M2
RAM: 8192 MiB
Backend: LLVM 21.1.5
Metadata
Metadata
Assignees
Labels
No labels