www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Internal error returning struct

struct Bar
{
 uint k;
 ubyte m;
}
Bar makebar() { Bar b; return b; }

int main()
{
 Bar b = makebar();
 return 0;
}


DMD v0.89 gives error:
Internal error: ..\ztc\cod1.c 1641

It has to do with the 2nd struct field being ubyte and the first being word
size I think. The number changed as I was narrowing the error down, it was
origionally:
Internal error: ..\ztc\cod1.c 2651

That error is when I assigned makebar()'s return value to a property setter
like this:

class Foo
{
 void foo(Bar b) {}
}

int main()
{
 Foo f = new Foo;
 f.foo = makebar();
 return 0;
}
May 18 2004