On Wednesday, 8 August 2018 at 08:15:16 UTC, Hakan Aras wrote:
Given this:

struct Num
{
    this(int a) {}
}

Is there any reason why this works:

Num n = 5;

but this doesnt:

Num funk()
{
    return 5;
}


I understand that I can construct it explicitely, but that gets annoying quickly, especially with templates.

I suppose, this is too slack.

What would work is

Num funk()
{
    return typeof(return)(5);
}

Reply via email to