Bug 3264 – -O causes wrong "used before set" error when using enum.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2009-08-25T05:01:00Z
Last change time
2015-06-09T01:28:06Z
Keywords
rejects-valid
Assigned to
nobody
Creator
clugdbug
Comments
Comment #0 by clugdbug — 2009-08-25T05:01:40Z
OK when compiled normally, but when compiled with -O, generates:
interpret.d(2367): Error: variable Q used before set
--------
void bug()
{
enum int Q=0;
string [2] s = ["a", "b"];
assert(s[Q].dup=="a");
}