Comparison of struct with Nullable member
Meta via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 17 08:30:40 PDT 2015
On Friday, 17 July 2015 at 12:18:56 UTC, TC wrote:
> Hello,
> I came around a strange behavior and I'm not sure if it is a
> bug or feature.
>
> import std.typecons : Nullable;
> struct Foo
> {
> string bar;
> Nullable!int baz;
> }
>
> auto a = Foo("bb");
> auto b = Foo("bb");
> assert(a == b);
>
> This ends up with: Called `get' on null Nullable!int
>
> But if I change bar to be an int for example, than it passes ok.
> I would expect this to pass ok.
>
> Tested on dmd 2.067.1 win64
https://issues.dlang.org/show_bug.cgi?id=14804
I'll probably be able to submit a PR for this sometime in the
next few days.
More information about the Digitalmars-d-learn
mailing list