Skip to content

[BUG] Single out return should be allowed #1119

@DyXel

Description

@DyXel

Describe the bug
Having a function that returns a single value should be allowed to be out (just like forward and move).

To Reproduce

main: () -> int = {
    return my_call();
}
my_call: () -> out result: int = {
	result = EXIT_SUCCESS;
}

Outputs:

test.cpp2...
test.cpp2(4,16): error: only 'forward' and 'move' return passing style are allowed from functions (at 'out')

Additional context
Do note that having parentheses make the example work, but I don't see why having a single out parameter shouldn't work:

main: () -> int = {
    return my_call();
}
my_call: () -> (out result: int) = {
	result = EXIT_SUCCESS;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions