[Issue 2444] New: structs should allow calling the normal blitting function when overriding opAssign

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Nov 6 07:55:39 PST 2008


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

           Summary: structs should allow calling the normal blitting
                    function when overriding opAssign
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: schveiguy at yahoo.com


In D1, if I overload opAssign in a struct, I cannot create an overload that
takes the struct as an argument.  This is marked as illegal.

However, in a recent version of D2 (not sure which one), this became legal. 
However it has a bad side effect.  If I want to overload opAssign for an
argument other than the struct, for example an int, then it masks the overload
that just does the blitting.  I have to re-implement the blitting version.

I understand that an author may want to control opAssign to the point of
disallowing simple blitting copy.  But if desired, it is a PITA to do the
blitting manually.  It would be nice to be able to alias the original function,
or flag the struct somehow so that the compiler will use the blitting function
when assigning one struct to another.


-- 



More information about the Digitalmars-d-bugs mailing list