[Issue 6167] RefCounted and lazy/delegate
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Oct 26 04:45:50 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6167
Denis Shelomovskij <verylonglogin.reg at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |verylonglogin.reg at gmail.com
Resolution| |DUPLICATE
--- Comment #3 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2012-10-26 15:45:47 MSD ---
Reduced testcase:
---
import std.stdio;
struct Struct
{
int dummy, count = 0;
this(int dummy)
{ writefln(" this(dummy = %s): count: %s", this.dummy = dummy, ++count); }
~this()
{ writefln("~this(dummy = %s): count: %s", dummy, --count); }
static Struct getWithDummy2()
{
return Struct(2);
}
}
static Struct neverCalled()
{
assert(0);
}
void lazyFun(lazy Struct exp)
{ }
void main()
{
Struct var = Struct(1);
(){ return var.getWithDummy2(); }();
lazyFun(neverCalled());
}
---
Output:
---
this(dummy = 1): count: 1
this(dummy = 2): count: 1
~this(dummy = 2): count: 0
~this(dummy = 10366848): count: 4203019
~this(dummy = 1): count: 0
---
So this is a duplicate of Issue 8182 which is fixed in dmd 2.060.
*** This issue has been marked as a duplicate of issue 8182 ***
--
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