gcc error compiling generics calls with casts to boxed float, double, struct args
I'm getting gcc errors compiling generics calls with casts to boxed float, double or struct args with up-to-date-ish vala master. It's not a problem if explicit boxed type parameter is provided instead of doing the casts.
For example, given the following generic method:
private void expect_equal_success<T>(T actual, T expected, string? context = null) throws GLib.Error {
…
}
The following calls compile fine, both as vala and the generated C:
expect_equal_success((int?) 42, (int?) 42);
expect_equal_success((int?) fourty_two_int, (int?) fourty_two_int);
expect_equal_success<int?>(fourty_two_int, fourty_two_int);
expect_equal_success<float?>(42.0f, 42.0f);
expect_equal_success<float?>(fourty_two_float, fourty_two_float);
But while vala compiles these fine, their generated C code fails to compile:
expect_equal_success((float?) 42.0f, (float?) 42.0f);
expect_equal_success((float?) fourty_two_float, (float?) fourty_two_float);
Same for double and struct.
The first successful example call above value gets compiled to this C:
test_assertions_expect_equal_success (self, G_TYPE_INT, NULL, NULL, (gpointer) ((gintptr) 42), (gpointer) ((gintptr) 42), NULL, &_inner_error0_);
The first failing example gets compiled to this:
test_assertions_expect_equal_failure (self, G_TYPE_FLOAT, (GBoxedCopyFunc) _float_dup, (GDestroyNotify) g_free, (gfloat*) 42.0f, (gfloat*) (-42.0f), NULL, &_inner_error0_);
Which gcc bails out on:
../test/test-assertions.vala: In function ‘test_assertions_float_equality_assertions’:
../test/test-assertions.vala:79:2: error: cannot convert to a pointer type
79 | expect_equal_success((float?) 42.0f, (float?) 42.0f);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~