mirror of
https://github.com/dlang/phobos.git
synced 2025-05-05 09:30:49 +03:00
Merge pull request #4727 from Cauterite/patch-1
fix Issue 16383 - 'Algebraic visit does not match const'
This commit is contained in:
commit
0538d0ce15
1 changed files with 13 additions and 1 deletions
|
@ -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 ~ "'");
|
||||
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue