www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 856] New: foreach doesn't work when accessing elements as supertypes

reply d-bugmail puremagic.com writes:

           Summary: foreach doesn't work when accessing elements as
           Product: D
           Version: 1.00
          Platform: PC
               URL: http://dstress.kuehne.cn/run/c/cast_29_B.d
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: braddr puremagic.com

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;


$ dmd cast_29_B.d
cast_29_B.d(12): Error: foreach: Bar[] is not an array of

Jan 19 2007
parent d-bugmail puremagic.com writes:

Alexey Ivanov <aifgi90 gmail.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
                 CC|                            |aifgi90 gmail.com
         Resolution|                            |WORKSFORME

--- Comment #1 from Alexey Ivanov <aifgi90 gmail.com> 2010-01-15 17:02:56 PST
Works in dmd 1.055 and dmd 2.039

Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 15 2010