[Issue 1402] New: imbricated structs, functions and "with" generate invalid code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 4 23:24:25 PDT 2007
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 at users.sf.net
ReportedBy: thecybershadow at 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".
--
More information about the D.gnu
mailing list