Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Negating array literal in default argument does not negate argument

Open goldenbergdaniel opened this issue 4 months ago • 7 comments

Context

Odin: dev-2025-04-nightly OS: Ubuntu 24.10, Linux 6.11.0-26-generic CPU: AMD Ryzen 7 6800H with Radeon Graphics RAM: 14703 MiB Backend: LLVM 20.1.1

package main

import "core:fmt"

WORLD_WIDTH :: 100
WORLD_HEIGHT :: 100

main :: proc()
{
  region_to_world_space({0, 0})
}

region_to_world_space :: proc(coord: [2]f32, region: [2]f32 = {-1, -1}) -> [2]f32
{
  fmt.println(region) // Prints: {1, 1}
  return coord + ({WORLD_WIDTH, WORLD_HEIGHT} * region)
}

Expected Behavior

Value of region parameter should be: {-1, -1}

Current Behavior

Current value is: {1, 1}

goldenbergdaniel avatar Jun 01 '25 23:06 goldenbergdaniel