Skip to content

Stage2 validate extern types #12075

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

Merged
merged 3 commits into from
Jul 12, 2022
Merged

Conversation

Vexu
Copy link
Member

@Vexu Vexu commented Jul 11, 2022

Question: in stage1 pointers to zero bit types are zero bit types themselves and are therefore not allowed in extern types but with #6706 they now behave like other pointers. This means that *void is now allowed in extern types even though it's not the same as *anyopaque that the user likely meant. Is this OK? Relevant test case is optional_pointer_to_void_in_extern_struct.zig.

@Vexu Vexu force-pushed the stage2-validate-extern branch from 779bb22 to 122c76a Compare July 11, 2022 17:30
@andrewrk
Copy link
Member

I think it's OK. In fact, I was wondering if we should take it a step further and remove anyopaque now that *void functions almost identically. This would remove one strange new thing that Zig introduces from the language.

@andrewrk andrewrk merged commit dc815e5 into ziglang:master Jul 12, 2022
@Vexu Vexu deleted the stage2-validate-extern branch July 12, 2022 07:16
@Vexu
Copy link
Member Author

Vexu commented Jul 12, 2022

I was wondering if we should take it a step further and remove anyopaque now that *void functions almost identically

It would be nice but I think it would also lead in to new strange things that don't currently exist. For example in stage2 dereferencing a runtime known *anyopaque gives the error values of type 'anyopaque' must be comptime known, but operand value is runtime known but dereferencing *void is allowed.

@andrewrk
Copy link
Member

Good point.

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.

2 participants