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

extern and packed modifiers can appear on opaque types #22880

Open
190n opened this issue Feb 13, 2025 · 0 comments · May be fixed by #22881
Open

extern and packed modifiers can appear on opaque types #22880

190n opened this issue Feb 13, 2025 · 0 comments · May be fixed by #22881
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@190n
Copy link
Contributor

190n commented Feb 13, 2025

Zig Version

0.14.0-dev.3213+53216d2f2

Steps to Reproduce and Observed Behavior

Compile a Zig file that uses extern opaque and packed opaque types:

// foo.zig
const X = extern opaque {};
const Y = packed opaque {};

export fn foo(x: *X, y: *Y) void {
    _ = x;
    _ = y;
}

The build succeeds:

$ zig build-obj foo.zig
$ echo $?
0
$ ls foo.o
foo.o

Expected Behavior

This should be a compile error. extern and packed are meant to control a type's layout, so they make no sense to apply to an opaque type as those types have unknown layout.

@190n 190n added the bug Observed behavior contradicts documented or intended behavior label Feb 13, 2025
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

Successfully merging a pull request may close this issue.

1 participant