void testref(ref int[] arr)
{
    arr[0] = 1;
}

void test(int[] arr)
{
    arr[0] = 1;
}

void main()
{
    //int[] buffer1 = new int[4]; // This works
    int[4] buffer1; // This doesn't
    int[4] buffer2;

    testref(buffer1);
    test(buffer2);
        
    assert(buffer1[0] == 1);
    assert(buffer2[0] == 1);
}

I'm not sure why my code doesn't work?? Isn't the buffer just an array with a fixed length? DMD is telling me 'buffer1 is not an lvalue'. The non ref version works fine?!

Reply via email to