Template class' method returning template object issues gcc warning
Submitted by Aleksander Wabik
Link to original bug (#615305)
Description
Testcase:
//-------------------------------------------
public class TmplClass<K>
{
public K[]? obj;
public K[]? get_obj()
{
return obj;
}
}
void main()
{
TmplClass<int>
test = new TmplClass<int>
();
int[] a;
a = test.get_obj();
}
//-------------------------------------------
Result of compilation:
/tmp/test.vala.c: In function '_vala_main': /tmp/test.vala.c:280: warning: assignment from incompatible pointer type
Cause of bug:
This bug is caused by translating method TmplClass.get_obj() to returning gpointer* in C, but this gpointer* is not being cast to int** where this method is being called on object of template type TmplClass<int>
.
Other effects:
This bug does not make code broken. It only issues not needed warning.
Version: 0.8.x