mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Add unittests for issue 11360.
This commit is contained in:
parent
a563a920eb
commit
042f3d4282
1 changed files with 18 additions and 0 deletions
|
@ -514,10 +514,16 @@ private:
|
|||
{
|
||||
t[i] = variantArgs[i].get!T();
|
||||
}
|
||||
|
||||
static if(is(ReturnType!A == void))
|
||||
{
|
||||
(*zis)(t.expand);
|
||||
*p = VariantN.init; // Uninitialized Variant.Uninitialized
|
||||
}
|
||||
else
|
||||
{
|
||||
*p = (*zis)(t.expand);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1643,6 +1649,18 @@ unittest
|
|||
assertThrown!VariantException(Variant(A(3)) < Variant(A(4)));
|
||||
}
|
||||
|
||||
// Handling of void function pointers / delegates, e.g. issue 11360
|
||||
unittest
|
||||
{
|
||||
static void t1() { }
|
||||
Variant v = &t1;
|
||||
assert(v() == Variant.init);
|
||||
|
||||
static int t2() { return 3; }
|
||||
Variant v2 = &t2;
|
||||
assert(v2() == 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a delegate or function to the given Algebraic depending on the held type,
|
||||
* ensuring that all types are handled by the visiting functions.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue