[Issue 4437] copy construction bug with "return this;"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 18 14:33:26 PDT 2010


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


Shin Fujishiro <rsinfu at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsinfu at gmail.com


--- Comment #1 from Shin Fujishiro <rsinfu at gmail.com> 2010-09-18 14:32:47 PDT ---
Reduced test case:
-------------------- test.d
void main()
{
    S s;
    auto t = s.copy();
    assert(t.count == 1);   // (5)
}
struct S
{
    int count;
    this(this) { ++count; }
    S copy() { return this; }
}
--------------------
% dmd -run test.d
core.exception.AssertError at test(5): Assertion failure
--------------------

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