Bug 2414 – enum is dynamically evaluated, yum

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2008-10-12T15:29:00Z
Last change time
2014-02-14T20:35:38Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
andrei
Blocks
4206

Comments

Comment #0 by andrei — 2008-10-12T15:29:44Z
Just compile this, run it, and have a laugh: import std.stdio; void main() { double a = 1, b = 2; enum c = a + b; writeln(c); a = 2, b = 3; writeln(c); }
Comment #1 by jarrett.billingsley — 2008-10-12T15:36:05Z
It's a macro! Weee!
Comment #2 by k.hara.pg — 2011-06-19T04:02:22Z
On trunk dmd (d36b3b12fc4814e59f3a0d680b8700e787b1ceff), ---- test.d(6): Error: variable a cannot be read at compile time test.d(6): Error: variable b cannot be read at compile time ---- It seems to me that this issue has been resolved.
Comment #3 by kennytm — 2011-06-19T12:34:17Z
This has been fixed in commit fc67 "Ensure compile-time constants are not variables(!)". Thanks Don. There should be a test case though. https://github.com/D-Programming-Language/dmd/commit/fc67046cf1e66182d959309fb15ef9e2d4c266b9