[Issue 19226] New: std.typecons.Nullable(T, T nullValue) doesn't fully handle non-self-equal nullValue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 5 18:09:49 UTC 2018


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

          Issue ID: 19226
           Summary: std.typecons.Nullable(T, T nullValue) doesn't fully
                    handle non-self-equal nullValue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com

Nullable(T, T nullValue) special-cases floating point numbers but this doesn't
account for all types where nullValue != nullValue. For instance:

https://run.dlang.io/is/hiLncI

---
struct S
{
    float f;
}

void main()
{
    import std.typecons : Nullable;

    alias N = Nullable!(S, S.init);
    assert(N(S.init).isNull); // Fails!
}
---

--


More information about the Digitalmars-d-bugs mailing list