Skip to content

Commit

Permalink
Merge pull request #4727 from Cauterite/patch-1
Browse files Browse the repository at this point in the history
fix Issue 16383 - 'Algebraic visit does not match const'
  • Loading branch information
schveiguy committed Aug 19, 2016
2 parents 7745673 + 8b50e13 commit 0538d0c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion std/variant.d
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

0 comments on commit 0538d0c

Please sign in to comment.