Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Unhelpful suggestion when trying to pass array expr to var args

Open thetarnav opened this issue 4 months ago • 0 comments

SQUARE :: [4][2]f32{
	{0, 0},
	{1, 0},
	{0, 1},
	{1, 1},
}

points: [dynamic][2]f32

append_elems(&points, ..(SQUARE * 100 + 100))

/* Error:
	Cannot assign value '(SQUARE * 100 + 100)' of type '[4][2]f32' to '[][2]f32' in a procedure argument
	Suggestion: The array expression may be sliced with (SQUARE * 100 + 100)[:]
*/

append_elems(&points, ..(SQUARE * 100 + 100)[:])

/* Error:
	Cannot slice array '(SQUARE * 100 + 100)[:]', value is not addressable
*/

report:

	Odin:    dev-2025-08:accdd7c2a
	OS:      Ubuntu 24.04.3 LTS, Linux 6.8.0-59-generic
	CPU:     Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz
	RAM:     15692 MiB
	Backend: LLVM 18.1.3

thetarnav avatar Aug 12 '25 13:08 thetarnav