D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23480 - non-empty ForStatement Increment clause should require a side effect
Summary: non-empty ForStatement Increment clause should require a side effect
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 enhancement
Assignee: No Owner
URL:
Keywords: diagnostic, pull
Depends on:
Blocks:
 
Reported: 2022-11-13 11:28 UTC by Nick Treleaven
Modified: 2022-11-15 13:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Nick Treleaven 2022-11-13 11:28:29 UTC
int j;
    for({} j; 1*1) {}
    for({j=2; int d = 3; } j+d<7; {j++; d++; }) {}

Each of the above Increment clauses should show 'has no effect' errors.

PR incoming.
Comment 1 Dlang Bot 2022-11-13 11:32:22 UTC
@ntrel created dlang/dmd pull request #14638 "Fix Issue 23480 - non-empty ForStatement Increment clause should requ…" fixing this issue:

- Fix Issue 23480 - non-empty ForStatement Increment clause should require a side effect

https://github.com/dlang/dmd/pull/14638
Comment 2 RazvanN 2022-11-14 11:03:06 UTC
*** Issue 16672 has been marked as a duplicate of this issue. ***
Comment 3 Dlang Bot 2022-11-15 13:49:38 UTC
dlang/dmd pull request #14638 "Fix Issue 23480 - non-empty ForStatement Increment clause should requ…" was merged into master:

- 6f0e20f4da6c142d062551c46dfc0a0392e6804b by Nick Treleaven:
  Fix Issue 23480 - non-empty ForStatement Increment clause should require a side effect

https://github.com/dlang/dmd/pull/14638