void parameter with generics
Related: #878 (closed)
How are we supposed to call a method, taking a parameter of type T
where T
is set to void
?
None of these four variants work:
class Test<T> : Object {
public void method(T t) {
}
}
void main() {
Test<void> t = new Test<void>();
// None of these work:
t.method();
t.method(null);
t.method((void)null);
t.method((void)0);
}
The last one passes through the vala compiler but produces invalid C code (void)0
.