www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1717] New: Template class with opAssign should be nullable

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1717

           Summary: Template class with opAssign should be nullable
           Product: D
           Version: 1.023
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: vertex gmx.at


class Foo(T)
{
T opAssign(T v) { return v; }
}

void main()
{
auto foo = new Foo!(float)();
foo = cast(Foo!(float))null; // Works
foo = null;                  // Error: Can't convert null to float
}

DMD should not try to implicitly cast null to template type, but set the
reference to null instead.


-- 
Dec 07 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1717


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX





This is (one reason) why opAssign for classes is getting dropped in D 2.0.


-- 
Jan 18 2008