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

Value: ensure that extern structs have their layout resolved in ptrField #23165

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kcbanner
Copy link
Contributor

@kcbanner kcbanner commented Mar 9, 2025

Fixes #23161.

Before this fix, "function pointer field call on global extern struct, conditional on global" reproduces the above.

This resolution feels like it should be conditional on something - since it seems to only be required when the call itself is conditional on a global - let me know if this resolution should be done elsewhere.

@alexrp alexrp added this to the 0.14.1 milestone Mar 10, 2025
var callbacks: Callbacks = undefined;
var callbacks_loaded: bool = false;

test "function pointer field call on global extern struct, conditional on global" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test "function pointer field call on global extern struct, conditional on global" {
test "function pointer field call on global extern struct, conditional on global" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;

}
}

test "function pointer field call on global extern struct" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
test "function pointer field call on global extern struct" {
test "function pointer field call on global extern struct" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, thanks! Fixed.

@kcbanner kcbanner force-pushed the globally_conditional_global_extern_field_call branch from 1cb8017 to 6c46a9b Compare March 10, 2025 14:22
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.

assert(struct_type.haveLayout(ip)) hit when calling a function pointer field of an extern struct
2 participants