Odin version: dev-2024-06 (Slightly modified to run on LLVM 17 and with a pre-compiled stb vendor library, since vendor:stb by default it doesn't seem to work out of the box on Linux)
This happens whenever I try to cast a variable of type ListenerProc to any type within the union. I found out that this happens because two #type procs inside the ListenerProc union have the same function signature:
The code works as intended if either of these proc types are omitted in the ListenerProc union. The compiler understands both of them to be the same despite being distinct type definitions, and when both are present within the same union type it thinks that one of the union values is duplicated
Context
vendor:stb
by default it doesn't seem to work out of the box on Linux)odin report
:Odin build instructions in Nix:
Expected Behavior
The following code should cast the variable
listener.handler
fromListenerProc
(union
) toMouseButtonHandler
(#type proc
)Current Behavior
Compiler gives me the following error when I try to run the code with
odin run:
This happens whenever I try to cast a variable of type
ListenerProc
to any type within the union. I found out that this happens because two#type procs
inside theListenerProc
union have the same function signature:And
The code works as intended if either of these
proc
types are omitted in theListenerProc
union. The compiler understands both of them to be the same despite being distinct type definitions, and when both are present within the sameunion
type it thinks that one of theunion
values is duplicated