-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
More extern type validation #7477
Conversation
Isn't this intentional? #6700 (comment) |
If you're exporting a pointer to some object you can't use in C I'd expect |
My apologies, please see #7336 (comment) |
I do like this extra check, it prevents a nasty footgun like const S = struct { ... }; // oh no! I skipped the extern!
extern fn foo(x: *S) void; // oh no! and makes the language more "regular", this is the only case where we don't check the child type. |
Validate the pointer child type when checking if a given type is valid for an extern function.
|
Another note on this: if we remove the result type from casts, this becomes a much bigger footgun - changing the type of a parameter would not cause compile errors at call sites because of the ptrCast. |
Spotted in #7336 by @andrewrk.