Bug 5981 – Can't used post defined constant at compile-time
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-05-11T11:06:00Z
Last change time
2015-06-09T05:13:49Z
Assigned to
nobody
Creator
Jesse.K.Phillips+D
Comments
Comment #0 by Jesse.K.Phillips+D — 2011-05-11T11:06:33Z
The following code compiles for 2.052 but fails in the beta for 2.053. This is done in DFL.
break.d(3): Error: variable value cannot be read at compile time
class B {
static:
ushort v2 = value;
const ushort value = 342;
}
void main() {
}
You can fix this by moving the declaration up or by defining it as an enum.
Comment #1 by lt.infiltrator — 2014-03-19T18:11:51Z