Bug 3135 – 'alias this' in struct breaks blitting

Status
RESOLVED
Resolution
DUPLICATE
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-07-04T17:17:00Z
Last change time
2015-06-09T01:27:58Z
Assigned to
nobody
Creator
kovrov+puremagic

Comments

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 ***