Showing with 13 additions and 1 deletion.
  1. +13 −1 std/variant.d
14 changes: 13 additions & 1 deletion std/variant.d
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ private auto visitImpl(bool Strict, VariantType, Handler...)(VariantType variant
result.exceptionFuncIdx = dgidx;
}
}
else static if (is(Unqual!(Params[0]) == T))
else static if (is(Params[0] == T) || is(Unqual!(Params[0]) == T))
{
if (added)
assert(false, "duplicate overload specified for type '" ~ T.stringof ~ "'");
Expand Down Expand Up @@ -2293,6 +2293,18 @@ unittest
assert(depth(fb) == 3);
}

unittest
{
// https://issues.dlang.org/show_bug.cgi?id=16383
class Foo {this() immutable {}}
alias V = Algebraic!(immutable Foo);

auto x = V(new immutable Foo).visit!(
(immutable(Foo) _) => 3
);
assert(x == 3);
}

unittest
{
// http://d.puremagic.com/issues/show_bug.cgi?id=5310
Expand Down