Can we make auto return type inference a little more lax?

Andrej Mitrovic none at none.none
Mon May 16 20:40:27 PDT 2011


auto foo()
{
    if (1)
    {
        return [0, 0];
    }
    else
    {
        size_t one;
        size_t two;
        
        return [one, two];
    }
}

void main(){ }

Error: mismatched function return type inference of
uint[] and int[]

Surely the compiler can figure out a common type for these two when literals are involved.


More information about the Digitalmars-d-learn mailing list