Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler assertion when omitting parapoly parameter in return type #4460

Open
IllusionMan1212 opened this issue Nov 6, 2024 · 0 comments
Open

Comments

@IllusionMan1212
Copy link
Contributor

IllusionMan1212 commented Nov 6, 2024

Context

  • Operating System & Odin Version:
        Odin:    dev-2024-11:e6475fec4
        OS:      Windows 11 Professional (version: 23H2), build 22631.4317
        CPU:     13th Gen Intel(R) Core(TM) i3-1315U
        RAM:     7835 MiB
        Backend: LLVM 18.1.8

Expected Behavior

Expected the compiler to error on the omitted parapoly parameter.

Current Behavior

Compiler asserts with llvm_backend_general.cpp(1856): Assertion Failure: "type != t_invalid" when building the below example.

Failure Information (for bugs)

The bug is reproducible with the below example. I believe it only happens when the parameter is omitted on a return type.

#3949 is a similar bug or if this is a duplicate then feel free to close it.

Steps to Reproduce

package main

Stack :: struct($Value: typeid) {
    top: ^StackNode(Value),
}

StackNode :: struct($Value: typeid) {
    next: ^StackNode(Value),
    v: Value,
}

pop_node :: proc(stack: ^Stack($T)) -> ^StackNode {
    popped := stack.top

    // Popping logic

    return popped
}

main :: proc() {
    stack: Stack(int)

    popped := pop_node(&stack)
}

The assertion goes away if we change the signature of pop_node to pop_node :: proc(stack: ^Stack($T)) -> ^StackNode(T)

Failure Logs

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant