Bug 8429 – [2.060 beta] 'version' rejected inside 'static if's

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-24T20:14:00Z
Last change time
2015-06-09T05:14:47Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla

Comments

Comment #0 by bus_dbugzilla — 2012-07-24T20:14:42Z
static if(true) version = Foo; static if(true) version(Foo) {} Worked in 2.059, fails to compile on 2.060 beta: test.d(2): Error: version Foo defined after use (Note: If you comment out line #3, it still fails, and that's issue #7386, but that's *not* a regression)
Comment #1 by bugzilla — 2012-07-24T20:22:23Z
I'm not so sure that version= declarations embedded inside static if's can ever work reliably.
Comment #2 by k.hara.pg — 2012-07-28T23:41:43Z
Comment #3 by github-bugzilla — 2012-07-29T13:15:21Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5d3de87ebd8ead3ccf96647f25c5207ba1558105 fix Issue 8429 - [2.060 beta] 'version' rejected inside 'static if's This is a regression of fixing bug 7911. Introduced commit: e558866cdd8c26daf90942ee6dd89e814347911b StaticIfDeclaration::setScope speculatively distributes the scope to members, and ConditionalDeclaration::setScope evaluate its condition. So, the root cause is too early evaluation of the condition of version block which in static if. https://github.com/D-Programming-Language/dmd/commit/e8fe11c20249cb9e42538be88c99b74ede4d12e3 Merge pull request #1070 from 9rnsr/fix8429 Issue 8429 - [2.060 beta] 'version' rejected inside 'static if's
Comment #4 by bugzilla — 2012-07-29T14:53:57Z
Unsure if this should be folded into D1 or not.