http://d.puremagic.com/issues/show_bug.cgi?id=3516


Brad Roberts <bra...@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bra...@puremagic.com


--- Comment #3 from Brad Roberts <bra...@puremagic.com> 2010-05-30 15:59:09 PDT 
---
Reduced test case:
extern(C) int printf(const char*, ...);

int numctor, numdtor;

struct Tid
{
    this(int i) { ++numctor; }
    ~this() { ++numdtor; }
}

Tid f() { return Tid(1); }

// This temporary is destroyed
void test1() { Tid tid = f(); }

// This (invisible) temporary is never destroyed
void test2() { f(); }

void main()
{
    numctor = numdtor = 0;
    test1();
    printf("numctor = %d, numdtor = %d\n", numctor, numdtor);
    assert(numctor == 1);
    assert(numdtor == 1);

    numctor = numdtor = 0;
    test2();
    printf("numctor = %d, numdtor = %d\n", numctor, numdtor);
    assert(numctor == 1);
    assert(numdtor == 1);
}

Current results:
numctor = 1, numdtor = 1
numctor = 1, numdtor = 0
core.exception.asserter...@bug3516(31): Assertion failure

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to