We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Odin: dev-2024-09-nightly:dd1f151 OS: Windows 11 Home Basic (version: 23H2), build 22631.4169 CPU: AMD Ryzen 5 5600X 6-Core Processor RAM: 32691 MiB Backend: LLVM 18.1.8
The following code demonstrates the problem:
package main import "core:fmt" Enum :: enum { P, Q } EnumArray :: [Enum]int main :: proc() { a: EnumArray = {.P = 2, .Q = 3} b: EnumArray = {.P = 4, .Q = 5} fmt.println(a + b) // prints [.P = 6, .Q = 8] fmt.println(a * b) // prints [.P = 8, .Q = 15] fmt.println(a + 2 * b) // does not compile // Workaround using transmute: fmt.println(a + transmute(EnumArray) (transmute([len(Enum)]int) b * 2)) // prints [.P = 10, .Q = 13] }
Scalar multiplication should work with enumerated arrays of numeric types exactly as it does with normal arrays of numeric types.
Enumerated arrays support addition and multiplication between each other, but not multiplication by scalars.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Context
The following code demonstrates the problem:
Expected Behavior
Scalar multiplication should work with enumerated arrays of numeric types exactly as it does with normal arrays of numeric types.
Current Behavior
Enumerated arrays support addition and multiplication between each other, but not multiplication by scalars.
The text was updated successfully, but these errors were encountered: