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

for-loops as while-loops is wrong for ranged-based for loop #528

Closed
roe85 opened this issue May 9, 2023 · 2 comments
Closed

for-loops as while-loops is wrong for ranged-based for loop #528

roe85 opened this issue May 9, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@roe85
Copy link

roe85 commented May 9, 2023

When using for-loops as while-loops

for (int i : {0,1}) {
  if (i == 0) continue;
}

Produces an endless loop, because the increment of ++__begin1 is skipped

@andreasfertig
Copy link
Owner

Hello @roe85,

thanks for reporting this issue! You're absolutely right. The transformation produces an infinite loop. It looked at the code there. Correcting this would require heavy transformations. I don't think this is worth the time and effort. In case you want to provide a fix, that would be great. Otherwise, I will close this issue as not to be fixed (NTBF).

Andreas

@andreasfertig
Copy link
Owner

Hello @roe85,

with the latest patch for coroutine support, I learned a few things which make this transformation easier. A fix is on its way.

Andreas

andreasfertig added a commit that referenced this issue Jun 22, 2023
Fixed #528: Added support for continue in alt-syntax-for transformation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants