[Issue 11135] New: Nullable(T, T nullValue) does not support NaN
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 28 01:05:06 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11135
Summary: Nullable(T, T nullValue) does not support NaN
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: patch
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: anoneuron at gmail.com
--- Comment #0 from anoneuron at gmail.com 2013-09-28 01:05:05 PDT ---
A little unsurprising, but quite annoying. See this simple test case:
void main() {
import std.stdio;
import std.typecons;
Nullable!(float, float.nan) Value;
writeln(Value.isNull, " <- should be true");
Value.nullify();
writeln(Value.isNull, " <- should be true");
};
Value.isNull always evaluates to false.
A simple patch in typecons.d seems to resolve the issue,
in the isNull function on line 1478, replace
return _value == nullValue;
with
return _value is nullValue;
I don't *think* this change could cause other issues, but I'm not completely
certain.
Tested using DMD v2.063.2 on WinXP.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list