www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2444] New: structs should allow calling the normal blitting function when overriding opAssign

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: schveiguy 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.


-- 
Nov 06 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2444


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Severity|normal                      |enhancement




-- 
Jan 11 2009