www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19488] New: std.typecons.Nullable(T, T nullValue) doesn't

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

          Issue ID: 19488
           Summary: std.typecons.Nullable(T, T nullValue) doesn't handle
                    NaN for built-in complex and imaginary
           Product: D
           Version: D2
          Hardware: All
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: n8sh.secondary hotmail.com

std.typecons.Nullable(T, T nullValue) doesn't handle NaN for built-in complex
and imaginary types. Example:

---
void main()
{
    import std.typecons;
    Nullable!(cfloat, cfloat.nan) a = cfloat.nan;
    assert(a.isNull); // fails

    Nullable!(ifloat, ifloat.nan) b = ifloat.nan;
    assert(b.isNull); // fails if above is commented out
}
---

--
Dec 14 2018