Open
Description
Context
From my understanding, when transmuting a value to a bool the behavior should be similar to C where zero is considered false and anything else is considered true. The problem arises when trying to transmute a value that is neither zero nor one. While there is no error, the resulting boolean is never equal to the untyped boolean "true".
- Operating System & Odin Version:
Odin: dev-2025-01-nightly
OS: Bazzite 41 (FROM Fedora Silverblue), Linux 6.12.12-203.bazzite.fc41.x86_64
CPU: AMD Ryzen 9 5900X 12-Core Processor
RAM: 31986 MiB
Backend: LLVM 18.1.6
Expected Behavior
Transmuted boolean should be equal to untyped boolean "true".
Current Behavior
The comparison returns "false".
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
Please provide detailed steps for reproducing the issue.
package main
import "core:fmt"
main :: proc() {
bool_1_transmuted := transmute(bool)u8(1)
bool_2_transmuted := transmute(bool)u8(2)
fmt.println(bool_1_transmuted, bool_1_transmuted == true) // prints: true true
fmt.println(bool_2_transmuted, bool_2_transmuted == true) // prints: true false but should print true true
assert(bool_1_transmuted) // true
assert(bool_1_transmuted == true) // true
assert(bool_2_transmuted) // true
assert(bool_2_transmuted == true) // false but should be true
}