D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 16254 - [REG 2.072-devel] wrong switch skips initialization error with mixed in case labels
Summary: [REG 2.072-devel] wrong switch skips initialization error with mixed in case ...
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: rejects-valid
Depends on:
Blocks:
 
Reported: 2016-07-08 20:29 UTC by Martin Nowak
Modified: 2016-10-01 11:48 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 Martin Nowak 2016-07-08 20:29:30 UTC
cat > bug.d << CODE
bool bug(int val)
{
    switch (val)
    {
    mixin("case 0:");
        auto v = 0;
        return true;

    default:
        return false;
    }
}
CODE

dmd -c bug
----
bug.d(3): Error: 'switch' skips declaration of variable bug.bug.v at bug.d(6)
----

I'd guess something in the semantic order changed since 2.071.1.
Comment 1 github-bugzilla 2016-07-08 22:50:09 UTC
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/fdf70df83495542b9829a2853d0b1c6ee58d83ea
fix Issue 16254 - switch skips initialization error

- replace intended diagnostic error with deprecation
- checks should be improved to detect actual variable usage

https://github.com/dlang/dmd/commit/a9b56bad42d6abf03fe5aa894c105733197dec0c
Merge pull request #5922 from MartinNowak/fix16254

fix Issue 16254 - switch skips initialization error
Comment 2 github-bugzilla 2016-10-01 11:48:19 UTC
Commits pushed to stable at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/fdf70df83495542b9829a2853d0b1c6ee58d83ea
fix Issue 16254 - switch skips initialization error

https://github.com/dlang/dmd/commit/a9b56bad42d6abf03fe5aa894c105733197dec0c
Merge pull request #5922 from MartinNowak/fix16254