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.