Thread overview
[Issue 3135] New: 'alias this' in struct breaks blitting
Jul 05, 2009
Serg Kovrov
Jul 05, 2009
David Simcha
July 05, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3135

           Summary: 'alias this' in struct breaks blitting
           Product: D
           Version: 2.030
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: kovrov+puremagic@gmail.com


struct Test
{
    int foo;
    int bar;
    alias foo this; // this is important
}

void main()
{
    Test t1 = Test(3,5), t2;
    t2 = t1;  // blitting is messed up?
    assert (t1.foo == t2.foo);
    assert (t1.bar == t2.bar); // will throw
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 05, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3135





--- Comment #1 from Serg Kovrov <kovrov+puremagic@gmail.com>  2009-07-04 17:23:14 PDT ---
An empty postblit function helps to workaround this issue:

struct Test
{
    int foo;
    int bar;
    this(this) {}  // this somehow fixes 'alias this' blitting
    alias foo this;
}

Still, this is very nasty bug, as error is completely silent.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 05, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3135


David Simcha <dsimcha@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |dsimcha@yahoo.com
         Resolution|                            |DUPLICATE




--- Comment #2 from David Simcha <dsimcha@yahoo.com>  2009-07-05 07:32:52 PDT ---


*** This issue has been marked as a duplicate of issue 2943 ***

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