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 672099 - [Generics] Invalid C code when accessing enum property of generic class
[Generics] Invalid C code when accessing enum property of generic class
Status: RESOLVED DUPLICATE of bug 774713
Product: vala
Classification: Core
Component: Generics
0.15.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2012-03-14 21:10 UTC by Severin Heiniger
Modified: 2016-11-30 17:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (397 bytes, text/x-vala)
2012-03-14 21:10 UTC, Severin Heiniger
Details

Description Severin Heiniger 2012-03-14 21:10:59 UTC
Created attachment 209780 [details]
Test case

The attached test-case uses a generic wrapper class to store an enum value as a property and later accesses it. The access statement causes valac to generate invalid code, yielding the error message "incompatible types when assigning to type ‘SomeEnum’ from type ‘gconstpointer’".

The C code in question is the following:

gconstpointer _tmp4_;
SomeEnum _tmp5_;
[...]
_tmp4_ = wrapper_get_object (enum_wrapper);
_tmp5_ = _tmp4_;
g_assert (GPOINTER_TO_INT (_tmp5_) == SOME_ENUM_FIRST);

Note that storing a raw integer value in a wrapper object works, even though the compilation yields the warning message "assignment makes integer from pointer without a cast".

As a work-around, one can resort to a simple field rather than a GObject property.
Comment 1 Al Thomas 2016-11-30 17:58:00 UTC

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