Bug 4786 – enum of run-time array length

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-09-01T12:11:00Z
Last change time
2011-06-26T05:25:12Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-09-01T12:11:48Z
This compiles with no errors with DMD 2.048, but I think it's a bug, because args.length is a value known only at a run-time, while enum is for values known at compile-time: void main(string[] args) { enum int n = args.length; }
Comment #1 by clugdbug — 2010-09-01T12:22:25Z
It's definitely a bug. Have a look at bug 2414 for a more humorous example.
Comment #2 by nfxjfg — 2010-09-01T12:29:08Z
Possibly related to bug 4397?
Comment #3 by bearophile_hugs — 2011-06-26T05:25:12Z
In DMD 2.053 it gives an error message.