[Issue 9036] New: postblit is called for nested structs when assigning `init`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 16 11:40:09 PST 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9036
Summary: postblit is called for nested structs when assigning
`init`
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: wrong-code
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-11-16 22:40:07 MSK ---
Note that we have zero context pointer in such postblit call:
---
int i;
struct S
{ this(this) { ++i; } }
void main()
{
S s = S.init;
assert(i == 0); // postblit not called
s = S.init;
assert(i == 0); // postblit not called
int k;
static int j = 0;
struct N
{
this(this)
{
++j;
assert(this.tupleof[$-1] != null); // fails
}
void f() { ++k; }
}
N n = N.init;
assert(j == 0); // fails, j = 1, postblit called
n = N.init;
assert(j == 0); // fails, j = 2, postblit called
}
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list