After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710865 - Incorrect cast on accessing a property from an abstract parent class
Incorrect cast on accessing a property from an abstract parent class
Status: RESOLVED DUPLICATE of bug 779219
Product: vala
Classification: Core
Component: Code Generator: GObject
unspecified
Other All
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2013-10-25 10:09 UTC by Philip Withnall
Modified: 2017-03-11 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Vala test case (242 bytes, text/x-vala)
2013-10-25 10:09 UTC, Philip Withnall
Details
Generated C code for test case (1.32 KB, text/x-csrc)
2013-10-25 10:10 UTC, Philip Withnall
Details

Description Philip Withnall 2013-10-25 10:09:18 UTC
If I have a Gee.HashMap and access its .values property, the generated C code will (correctly) call gee_abstract_map_get_values(). However, the object passed to that call will be cast to (GeeMap*) (which is the interface implemented by GeeAbstractMap) — it should instead be cast to (GeeAbstractMap*).

This causes GCC to print the following warning, specifying that we’re violating the C type system:

backend-store.c: In function '_folks_backend_store_get_modules_from_dir_co':
backend-store.c:2636:8: warning: passing argument 1 of 'gee_abstract_map_get_entries' from incompatible pointer type [enabled by default]
        _data_->_tmp39_ = gee_abstract_map_get_entries ((GeeMap*) G_TYPE_CHECK_INSTANCE_CAST (_data_->_tmp38_, GEE_TYPE_HASH_MAP, GeeHashMap));
        ^
In file included from backend-store.c:30:0:
/opt/gnome3/build/include/gee-0.8/gee.h:1457:9: note: expected 'struct GeeAbstractMap *' but argument is of type 'struct GeeMap *'


Test case coming.

This is with Vala 0.22.0.26-f79fe.
Comment 1 Philip Withnall 2013-10-25 10:09:47 UTC
Created attachment 258089 [details]
Vala test case

Here’s the Vala test case.
Comment 2 Philip Withnall 2013-10-25 10:10:17 UTC
Created attachment 258090 [details]
Generated C code for test case

Here’s the generated C code. The problem is on line 37.
Comment 3 Rico Tzschichholz 2017-03-11 15:47:01 UTC

*** This bug has been marked as a duplicate of bug 779219 ***