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

Empty struct incorrectly becomes void in varargs functions #2393

Closed
tgschultz opened this issue May 1, 2019 · 1 comment
Closed

Empty struct incorrectly becomes void in varargs functions #2393

tgschultz opened this issue May 1, 2019 · 1 comment
Labels
bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@tgschultz
Copy link
Contributor

const Empty = struct {};
fn foo(args:...) void {
    var e: Empty = args[0];
}
test "Empty" {
    foo(Empty(undefined));
}
error: expected type 'Empty', found 'void'
    var e: Empty = args[0];
                       ^

Should be fixed by #208 .

@andrewrk andrewrk added this to the 0.5.0 milestone May 1, 2019
@andrewrk andrewrk added the bug Observed behavior contradicts documented or intended behavior label May 1, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 3, 2019
@andrewrk
Copy link
Member

andrewrk commented Dec 9, 2019

Updated test which passes:

const Empty = struct {};
fn foo(args: var) void {
    var e: Empty = args[0];
}
test "Empty" {
    foo(.{@as(Empty, undefined)});
}

var args removed from the language in a3f6a58

@andrewrk andrewrk closed this as completed Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

2 participants