On Wednesday, 20 June 2018 at 11:43:52 UTC, DigitalDesigns wrote:
alias f = void delegate();
Tuple!(f)[] fs;

fs ~= tuple(() { });

fails but

fs ~= Tuple!(f)(() { });

passes.
in tuple, it is seeing the lambda as void and thinks I'm trying to append a tuple of void. I don't see why the compiler can't see that it works.

It's because if you don't specify any types, the compiler creates a template function so type inference for the arguments/return type can take place. It could probably be inferred without making the literal a template, but that's just how it's done currently.

Reply via email to