Comment #0 by kovrov+puremagic — 2009-07-04T17:17:31Z
struct Test
{
int foo;
int bar;
alias foo this; // this is important
}
void main()
{
Test t1 = Test(3,5), t2;
t2 = t1; // blitting is messed up?
assert (t1.foo == t2.foo);
assert (t1.bar == t2.bar); // will throw
}
Comment #1 by kovrov+puremagic — 2009-07-04T17:23:14Z
An empty postblit function helps to workaround this issue:
struct Test
{
int foo;
int bar;
this(this) {} // this somehow fixes 'alias this' blitting
alias foo this;
}
Still, this is very nasty bug, as error is completely silent.
Comment #2 by dsimcha — 2009-07-05T07:32:52Z
*** This issue has been marked as a duplicate of issue 2943 ***