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

implicit cast from @EnumTagType(TheUnion) to &const TheUnion #654

Closed
andrewrk opened this issue Dec 8, 2017 · 0 comments
Closed

implicit cast from @EnumTagType(TheUnion) to &const TheUnion #654

andrewrk opened this issue Dec 8, 2017 · 0 comments
Milestone

Comments

@andrewrk
Copy link
Member

@andrewrk andrewrk commented Dec 8, 2017

const assert = @import("std").debug.assert;

const TheUnion = union(enum) {
    Item1,
    Item2: i32,
};

test "implicit cast from @EnumTagType(TheUnion) to &const TheUnion" {
    foo(TheUnion.Item1);
}

fn foo(value: &const TheUnion) {
    assert(*value == TheUnion.Item1);
}
@andrewrk andrewrk added this to the 0.2.0 milestone Dec 8, 2017
@andrewrk andrewrk closed this in 756a218 Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant