[Issue 24233] New: T[].canFind(Nullable!T()) returns true when it used to return false

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 8 16:06:54 UTC 2023


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

          Issue ID: 24233
           Summary: T[].canFind(Nullable!T()) returns true when it used to
                    return false
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: regression
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

This is a result of the behavioral change that Nullable!T now acts as a range.
(Thanks Herringway!) Previously, the `opEquals` overload would allow `T ==
Nullable!T()` to always be false. Now, instead the overload of `canFind` that
takes a range is selected, to which `Nullable!T()` acts as an empty range, so
that `canFind` is vacuously true.

There is not really anything that can be done about this short of reverting the
`Nullable!T` range change, which would at this point itself be a regression.
Nonetheless, it *is* a regression, so might as well file it.

--


More information about the Digitalmars-d-bugs mailing list