[Issue 1717] New: Template class with opAssign should be nullable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 7 20:50:10 PST 2007


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 at digitalmars.com
        ReportedBy: vertex at 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.


-- 



More information about the Digitalmars-d-bugs mailing list