[Issue 22647] New: [std.variant.Variant] Cannot compare types compliant with null comparison with 'null'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 3 23:11:50 UTC 2022


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

          Issue ID: 22647
           Summary: [std.variant.Variant] Cannot compare types compliant
                    with null comparison with 'null'
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: jlourenco5691 at gmail.com

std.variant.Variant should behave the same as the core language. Some types are
comparable with null (arrays and pointers). If the Variant's current type is
one of those, then comparing with null should be allowed.

```
import std;

void main()
{
    int* ptr;
    Variant a = ptr; // is of type int*

    assert(ptr == null); // true
    assert(a == null); // false
}
```

--


More information about the Digitalmars-d-bugs mailing list