Wrong value for dependent default argument
If default value of argument depends on value of other argument, valac fails to provide correct substitution, and generates wrong code.
void function (int a = 321, int b = a) {}
void main () {
function ();
function (1);
}
generates
voidfunction (gint a,
gint b)
{
}
void
_vala_main (void)
{
function (321, a);
function (1, a);
}
so C compiler fails with error
error: ‘a’ undeclared (first use in this function)
valac --version
Vala 0.49.91.9-e451f
Edited by Sergii Fesenko