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

cgen: support inc cond for c style for loop with alias types #21708

Merged
merged 4 commits into from
Jun 22, 2024

Conversation

Delta456
Copy link
Member

Fixes #21707

@Delta456 Delta456 marked this pull request as ready for review June 20, 2024 19:16
Comment on lines -523 to +525
g.write(';')
if !g.inside_for_c_stmt {
g.write(';')
}
Copy link
Member

Choose a reason for hiding this comment

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

That is short, but does not seem the right place for the fix.
Why does the non aliased case work, without such check?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is because the assignment operator overloading here assumes to be a statement ending with the ; but in a for c loop it is not the case. I also can't find a better place to make it work because it returns after code generation.

I tried removing the return and adding the g.write(';') but the compiler failed.

@spytheman spytheman merged commit 2bb815f into vlang:master Jun 22, 2024
76 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.

c-style for loop with type alias provokes build error
2 participants