http://d.puremagic.com/issues/show_bug.cgi?id=10771
[email protected] changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from [email protected] 2013-08-08 10:31:03 PDT --- (In reply to comment #0) > The following code should work and assert should pass. > On dmd 2.063.2 assert "Called `get' on null Nullable!Test" occurs instead > --- > import std.typecons; > void main() > { > struct Test{ > int a; > } > Nullable!Test a; > Nullable!Test b; > assert(a==b); > } > --- > > So, IMO Nullable!T needs opEquals implemented. I'm not sure it should. It would blend the notion of *what* the comparison compares. For example, in the opposite case: Nullable!Test a; Nullable!Test b = 5; if (a == b) ... //Legal ? Arguably, this is a mistake, as a null was used in a comparison. But it now simply returns false. And I don't think it's OK to assert when *one* of both are null, yet not both, so I'm not entirely sure about the proposed enhancement. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
