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

allow implicit cast from &const to ?&const &const #796

Merged
merged 1 commit into from Feb 28, 2018
Merged

allow implicit cast from &const to ?&const &const #796

merged 1 commit into from Feb 28, 2018

Conversation

bnoordhuis
Copy link
Contributor

Allow implicit casts from n-th degree const pointers to nullable const
pointers of degree n+1. That is:

fn f() void {
    const s = S {};
    const p = &s;
    g(p);   // Works.
    g(&p);  // So does this.
}

fn g(_: ?&const &const S) void {  // Nullable 2nd degree const ptr.
}

Fixes #731 some more.

Note that e.g. &const ?&const doesn't work yet. Still working on that.

Allow implicit casts from n-th degree const pointers to nullable const
pointers of degree n+1.  That is:

    fn f() void {
        const s = S {};
        const p = &s;
        g(p);   // Works.
        g(&p);  // So does this.
    }

    fn g(_: ?&const &const S) void {  // Nullable 2nd degree const ptr.
    }

Fixes #731 some more.
@andrewrk
Copy link
Member

I love that thanks to your other pull request, we can now put struct definitions inside the tests that need them.

@andrewrk andrewrk merged commit 0f449a3 into ziglang:master Feb 28, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants