Skip to content

Commit

Permalink
Merge pull request #5541 from jmdavis/issue_17482
Browse files Browse the repository at this point in the history
Fix issue 17482: Fix Nullable!Variant equality checks.
merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach@gmail.com>
  • Loading branch information
dlang-bot authored Jul 7, 2017
2 parents bff3364 + a7ea880 commit d07b101
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion std/typecons.d
Original file line number Diff line number Diff line change
Expand Up @@ -2228,7 +2228,8 @@ Params:
}

/// Ditto
bool opEquals()(auto ref const(T) rhs) const
bool opEquals(U)(auto ref const(U) rhs) const
if (is(typeof(this.get == rhs)))
{
return _isNull ? false : rhs == _value;
}
Expand Down Expand Up @@ -2276,6 +2277,16 @@ Params:
assert(a != Nullable!int(29));
}

// Issue 17482
@system unittest
{
import std.variant : Variant;
Nullable!Variant a = Variant(12);
assert(a == 12);
Nullable!Variant e;
assert(e != 12);
}

template toString()
{
import std.format : FormatSpec, formatValue;
Expand Down

0 comments on commit d07b101

Please sign in to comment.