Hi there,

I think I may have found a bug in valac concerning default arguments to
functions.

I'm wondering if what I am doing is wrong, or whether its allowed.

Thanks,
Sam




The following code compiles into incorrect C:

void do_something(uint8[] array1,
                  uint8[] array2,
                  int len = int.min(array1.length, array2.length))
{
    // Do something
}

int main(string[] args)
{
    uint8[] a1 = new uint8[5];
    uint8[] a2 = new uint8[6];
    
    do_something(a1, a2);
    
    return 0;
}

I get the following errors:

In function ‘_vala_main’:
error: ‘array1_length1’ undeclared (first use in this function)
error: (Each undeclared identifier is reported only once
error: for each function it appears in.)
error: ‘array2_length1’ undeclared (first use in this function)


_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to