Skip to content

panic when passing (T, Allocator_Error) to variadic ..any in formatting procedures #5965

@heavyrain266

Description

@heavyrain266

Context

I was trying to log the dxgi.IAdapter4 metadata using windows.utf16_to_utf8(), and noticed that it triggers a panic during type checking if you don't bind returned values to variables, and only pass the string to formatter.

Odin:    dev-2025-11:9712624
OS:      Windows 11 Professional (version: 25H2), build 26200.7171
CPU:     AMD Ryzen 7 7800X3D 8-Core Processor
RAM:     31892 MiB
Backend: LLVM 20.1.0

Expected Behavior

The compiler should not panic, it could throw an error (or warning) with suggestion to handle Allocator_Error instead of passing it to formatting procs.

Current Behavior

main::main
lb_emit_conv: src -> dst
Not Identical Allocator_Error != []any
Not Identical u8 != []any
Not Identical 2769f57e5c0 != 2769f6e6b00
Not Identical 7ff72c6f3348 != 2769f6e6b00
odin\src\llvm_backend_expr.cpp(2880): Panic: Invalid type conversion: 'Allocator_Error' to '[]any' for procedure 'main::main'

Steps to Reproduce

package main

import "core:fmt"
import "core:sys/windows"

main :: proc() {
	foo : []u16 = {72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100, 33}
	fmt.printfln(windows.utf16_to_utf8(foo[:]))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions