-
-
Notifications
You must be signed in to change notification settings - Fork 798
Open
Description
Context
Odin: dev-2025-07:315cd51f7
OS: Windows 11 Home Basic (version: 24H2), build 26100.4652
CPU: AMD Ryzen 5 5600X 6-Core Processor
RAM: 32712 MiB
Backend: LLVM 20.1.0
Expected Behavior
Casting to a procedure type that differs only by parameter names and then calling the procedure using the new names should work
ProcA :: proc(a: int) {}
ProcA(a = 0)
ProcB :: cast(proc(b: int)) ProcA
ProcB(b = 0)
ProcC := proc(a: int) {}
ProcC(a = 0)
ProcD := cast(proc(b: int)) ProcC
ProcD(b = 0)
Current Behavior
Casting works in all cases but calling causes either seemingly wrong compiler errors or an llvm assertion
// Odin: dev-2025-07:315cd51f7
// OS: Windows 11 Home Basic (version: 24H2), build 26100.4652
// CPU: AMD Ryzen 5 5600X 6-Core Processor
// RAM: 32712 MiB
// Backend: LLVM 20.1.0
package main
main :: proc()
{
ProcA :: proc(a: int){}
ProcA(a = 0)
when false
{
// D:\odin\src\llvm_backend_proc.cpp(4295): Assertion Failure: `param_index >= 0`
(cast(proc(b: int)) ProcA)(b = 0)
}
when false
{
// W:/proc_lit_llvm_assert.odin(32:3) Error: Parameter 'a' of type 'int' is missing in procedure call
// ProcB(b = 0)
// ^~~~~~~~~~~^
// W:/proc_lit_llvm_assert.odin(32:9) Error: No parameter named 'b' for this procedure type
// ProcB(b = 0)
// ^~~~^
ProcB : proc(b: int) : ProcA
ProcB(b = 0)
}
when false
{
// W:/proc_lit_llvm_assert.odin(45:3) Error: Parameter 'a' of type 'int' is missing in procedure call
// ProcB(b = 0)
// ^~~~~~~~~~~^
// W:/proc_lit_llvm_assert.odin(45:9) Error: No parameter named 'b' for this procedure type
// ProcB(b = 0)
// ^~~~^
ProcB :: cast(proc(b: int)) ProcA
ProcB(b = 0)
}
ProcC := proc(a: int) {}
when false
{
// D:\odin\src\llvm_backend_proc.cpp(4295): Assertion Failure: `param_index >= 0`
(cast(proc(b: int)) ProcC)(b = 0)
}
ProcD : proc(b: int) = ProcC
ProcD(b = 0)
}
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
compile the snippet provided in "Current Behavior" and toggle one of the when false
statements.
Metadata
Metadata
Assignees
Labels
No labels