Bug 1171 – Cannot create a static array with the length of a const static array in function scope, D1 only

Status
RESOLVED
Resolution
WONTFIX
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-20T13:26:00Z
Last change time
2014-02-16T15:23:21Z
Keywords
rejects-valid
Assigned to
nobody
Creator
matti.niemenmaa+dbugzilla

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2007-04-20T13:26:54Z
(Set version to 1.012: there's no 1.013 yet.) void main() { const int[2] foo; int[foo.length] bar; } Compiling the above results in the error "Error: no property 'length' for type 'int'". No module or line information, hence the "diagnostic" keyword on this bug. Move the code outside of function scope and/or remove the const from "foo" and the code compiles. Also, replacing foo.length with mixin("foo.length") works, which is odd.
Comment #1 by thomas-dloop — 2007-04-23T12:54:19Z
Comment #2 by clugdbug — 2010-02-01T00:01:54Z
The line number bug was fixed between 1.030 and 1.036. Removing 'diagnostic' from the warning. Works on D2. (Actually, I think the bug is that D1 allows you create a const array with no initializer).
Comment #3 by yebblies — 2013-11-16T23:17:10Z
Closing because D1 is no longer supported.