For an application/library I’m writing (in vala) I’ve come up against some error regarding generics I can’t really explain. I have a generic struct
public struct Parameter { T value; }
For most types there is no problem specialising the is e.g.
public struct Integer : Parameter { Integer(int val) { this.value = val; } }
public struct String : Parameter { String(string val) { this.value = val; } }
both work fine. However when using double
or float
it doesn’t work
public struct Double : Paramter { Double(double val) { this.value = val; } }
This result in the error
error: incompatible types when assigning to type ‘gpointer’ {aka ‘void *’} from type ‘gdouble’ {aka ‘double’}