mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 23:50:31 +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,11 +514,17 @@ private:
|
||||||
{
|
{
|
||||||
t[i] = variantArgs[i].get!T();
|
t[i] = variantArgs[i].get!T();
|
||||||
}
|
}
|
||||||
|
|
||||||
static if(is(ReturnType!A == void))
|
static if(is(ReturnType!A == void))
|
||||||
|
{
|
||||||
|
(*zis)(t.expand);
|
||||||
*p = VariantN.init; // Uninitialized Variant.Uninitialized
|
*p = VariantN.init; // Uninitialized Variant.Uninitialized
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
*p = (*zis)(t.expand);
|
*p = (*zis)(t.expand);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: assert(false);
|
default: assert(false);
|
||||||
|
@ -1643,6 +1649,18 @@ unittest
|
||||||
assertThrown!VariantException(Variant(A(3)) < Variant(A(4)));
|
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,
|
* Applies a delegate or function to the given Algebraic depending on the held type,
|
||||||
* ensuring that all types are handled by the visiting functions.
|
* ensuring that all types are handled by the visiting functions.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue