D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19730 - if (auto x) {} isn't properly rejected
Summary: if (auto x) {} isn't properly rejected
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 regression
Assignee: No Owner
URL:
Keywords: accepts-invalid, pull
Depends on:
Blocks:
 
Reported: 2019-03-11 23:53 UTC by elpenguino+D
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description elpenguino+D 2019-03-11 23:53:26 UTC
```
void func() {
  bool x;
  if (auto x) {}
}
```
This is accepted as valid code, but it should not be. It is currently treated as if the auto is not present.

The last version to correctly reject this was DMD 2.062.
Comment 1 Dlang Bot 2019-03-12 02:11:09 UTC
@Basile-z created dlang/dmd pull request #9447 "[trivial] fix issue 19730 - if (auto x) {} isn't properly rejected" fixing this issue:

- fix issue 19730 - if (auto x) {} isn't properly rejected

https://github.com/dlang/dmd/pull/9447
Comment 2 Dlang Bot 2019-03-12 23:25:35 UTC
dlang/dmd pull request #9447 "[trivial] fix issue 19730 - if (auto x) {} isn't properly rejected" was merged into stable:

- 0f21ba04b42adbfbc3008fd1aec85be2c49dc298 by Basile Burg:
  fix issue 19730 - if (auto x) {} isn't properly rejected

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