www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3135] New: 'alias this' in struct breaks blitting

reply d-bugmail puremagic.com writes:
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: -------
Jul 04 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3135






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: -------
Jul 04 2009
prev sibling parent d-bugmail puremagic.com writes:
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





---


*** 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: -------
Jul 05 2009