[Issue 4356] Copy constructor not called under extremely mysterious circumstances

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 21 02:13:51 PDT 2010


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


Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com


--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> 2010-06-21 02:13:46 PDT ---
Simpler test case:

import std.c.stdio;

struct A
{
    int m;
    this(this)
    {
        printf("this(this) %p\n", &this);
    }
    ~this()
    {
        printf("~this() %p\n", &this);
    }
    A copy()
    {
        A another = this;
        return another;
    }
}

void main()
{
    A a;
    A b = a.copy();
    printf("a: %p, b: %p\n", &a, &b);
}

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