Add unittests for issue 11360.

This commit is contained in:
Ognjen Ivkovic 2013-10-25 20:24:05 -06:00
parent a563a920eb
commit 042f3d4282

View file

@ -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.