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

[stmt.for] Missing curly brackets in for-statement translation #7211

Open
Eelis opened this issue Aug 10, 2024 · 0 comments · May be fixed by #7212
Open

[stmt.for] Missing curly brackets in for-statement translation #7211

Eelis opened this issue Aug 10, 2024 · 0 comments · May be fixed by #7212

Comments

@Eelis
Copy link
Contributor

Eelis commented Aug 10, 2024

According to [stmt.for],

for (; false; ++i) int i = 5;

is equivalent to:

{
    ;
    while (false) {
        int i = 5;
        ++i;
    }
}

which is well-formed. But this is clearly not the intent, and all compilers I tried reject the for loop above (when there is no other i around, of course).

Eelis added a commit to Eelis/draft that referenced this issue Aug 10, 2024
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 a pull request may close this issue.

1 participant