www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 1402] New: imbricated structs, functions and "with" generate invalid code

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1402

           Summary: imbricated structs, functions and "with" generate
                    invalid code
           Product: DGCC aka GDC
           Version: 0.23
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: major
          Priority: P2
         Component: glue layer
        AssignedTo: dvdfrdmn users.sf.net
        ReportedBy: thecybershadow gmail.com


alias ubyte[10] MyArray;

struct MyInnerStruct
{
        MyArray a;
} 

struct MyStruct
{
        MyInnerStruct i;
}

void test(MyArray a)
{
        foreach(i,e;a)
                assert(i==e);
}

void main()
{
        MyStruct s;
        foreach(i,ref e;s.i.a)
                e = i;        // fill with [0,1,2,3,4,5,6,7,8,9]
        with(s.i)
                test(a);
}

Assert fails. Works without "with".


-- 
Aug 04 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1402


thecybershadow gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE





oops, it was already reported.

*** This bug has been marked as a duplicate of 1400 ***


-- 
Aug 04 2007