Bug 856 – foreach doesn't work when accessing elements as supertypes

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-01-19T02:01:00Z
Last change time
2014-02-15T13:12:35Z
Keywords
rejects-valid
Assigned to
nobody
Creator
braddr

Comments

Comment #0 by braddr — 2007-01-19T02:01:09Z
module dstress.run.c.cast_29_B; class Foo{ } class Bar : Foo{ } int main(){ Bar[] bars=new Bar[100]; foreach(Foo f; bars){ return 0; } assert(0); } $ dmd cast_29_B.d cast_29_B.d(12): Error: foreach: Bar[] is not an array of dstress.run.c.cast_29_B.Foo
Comment #1 by aifgi90 — 2010-01-15T17:02:56Z
Works in dmd 1.055 and dmd 2.039