www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14144] New: opAssign seems broken in master

https://issues.dlang.org/show_bug.cgi?id=14144

          Issue ID: 14144
           Summary: opAssign seems broken in master
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: deadalnix gmail.com

As per dustmite :

struct JSON {
union {
double _floating;
}

this(typeof(null) ) {
}

 trusted pure nothrow typeof(null) opAssign(typeof(null) nothing) {
    return null;
}

}

unittest {
JSON[string] x;
x["wat"] = null;
}

$ ../dmd/src/dmd json.d -unittest
json.d(20): Error: incompatible types for ((x["wat"].opAssign(null)) :
(x["wat"] = JSON , x["wat"].this(null))): 'typeof(null)' and 'JSON'

It work on the release and is breaking SDC.

--
Feb 07 2015