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

checker: fix C struct embedded init fields checking #21137

Merged
merged 3 commits into from Mar 31, 2024

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Mar 29, 2024

Fix #21046

#include "@VMODROOT/foo.h"

struct C.MyCStruct {
	data &u8
}

struct MyWrapper {
	C.MyCStruct
}

fn (it C.MyCStruct) wrap() MyWrapper {
	return MyWrapper{
		//MyCStruct: it
		data: it.data
	}
}

fn main() {
	dump(C.MyCStruct{data: 123}.wrap())
}

@felipensp felipensp marked this pull request as ready for review March 29, 2024 21:45
@spytheman
Copy link
Member

Can you add a test please?

@felipensp
Copy link
Member Author

Can you add a test please?

Done.

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit dbc4896 into vlang:master Mar 31, 2024
54 checks passed
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.

False errors when initializing an embedded C struct that contains a reference.
2 participants