Bug 9332 – [REG][2.060 -> 02.061] struct constructor taking itself creates 'Warning: statement is not reachable'

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-17T08:04:00Z
Last change time
2013-01-21T17:16:57Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-01-17T08:04:46Z
Most probably *just* introduced: the packaged 2.061 doesn't create this, but the latest githead produces the bug. Produced with dmd with both debug and release. win32 on a win7_64. //---- Program: //---- struct S { this(S) // <- Line 3 here { assert(0, "unreachable?"); } } void main() { S a; S b = S(a); } //---- //---- Compiler switch: //---- rdmd -wi -O main.d //---- //---- Compiler output //---- main.d(3): Warning: statement is not reachable //---- The irony here is that running the program gives: //---- [email protected](5): unreachable? //----
Comment #1 by monarchdodra — 2013-01-17T08:45:14Z
(In reply to comment #0) > Most probably *just* introduced: the packaged 2.061 doesn't create this, but > the latest githead produces the bug. Sorry, my bad, the problem *does* appear in 2.061, but not in 2.060.
Comment #2 by bugzilla — 2013-01-21T13:09:36Z
Comment #3 by github-bugzilla — 2013-01-21T15:47:11Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ea5ee9b2c1173b0f824ab19dcdeb2c409e7d613c fix Issue 9332 statement is not reachable https://github.com/D-Programming-Language/dmd/commit/f512ab6539a0b94bb342c993a8c50ae888b1f904 Merge pull request #1528 from WalterBright/b25 fix Issue 9332 statement is not reachable