Bug 11272 – Postblit is called instead of opAssign on a nested struct

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-15T04:33:00Z
Last change time
2013-10-15T06:03:31Z
Assigned to
nobody
Creator
samukha

Comments

Comment #0 by samukha — 2013-10-15T04:33:54Z
dmd v2.064-devel-339deaa: struct S { S1 s1; } struct S1 { static int assign; void opAssign(S1 s1) { assign++; } static int postblit; this(this) { postblit++; } static void reset() { assign = 0; postblit = 0; } } void main() { { S1 s, s2; s = s2; } assert(S1.assign == 1); // ok S1.reset(); { S s, s2; s = s2; } assert(S1.assign == 1); // fails, postblit count is 1 }
Comment #1 by samukha — 2013-10-15T04:43:18Z
Changed title to "Postblit is called instead of opAssign on a nested struct"
Comment #2 by monarchdodra — 2013-10-15T06:03:31Z
This is a duplicate of: http://d.puremagic.com/issues/show_bug.cgi?id=11202 *** This issue has been marked as a duplicate of issue 11202 ***