Bug 6655 – Forward error with static array length

Status
RESOLVED
Resolution
WORKSFORME
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-09-12T15:47:00Z
Last change time
2012-04-24T00:49:03Z
Keywords
diagnostic, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2011-09-12T15:47:11Z
D2 code: enum size_t N = 1; int[bar.length] foo; int[N] bar; void main() {} DMD 2.055 gives: Error: cannot create associative array int[N] This is a very nice bug. There are three problems here: refusing valid code, thinking bar is an associative array instead of a fixed-sized one, and giving no line number.
Comment #1 by yebblies — 2011-09-14T06:01:52Z
The problem here is that TypeAArray::getImpl is being called on bar before semantic has, therefore there is no scope or location. Of the three problems, the lack of scope causes the failure to lookup N (and therefore the failure to recognize bar as a static array), and also the lack of a file/line number.
Comment #2 by github-bugzilla — 2012-04-24T00:48:32Z
Comment #3 by bugzilla — 2012-04-24T00:49:03Z
Works in 2.059.