On Sunday, 3 August 2014 at 22:01:23 UTC, matt wrote:
auto value(Parent item, int type)
{
if(item.type == 1)
{
return Fun!double(cast(Child!double)item);
Here you're returning a double.
}
else if(item.type==2)
return Fun!string(cast(Child!string)item);
Here you're returning a string. You're trying to return different, incompatible types depending on runtime data (`type`). That's not possible. The return type must be known at compile time.
