GNOME Bugzilla – Bug 672099
[Generics] Invalid C code when accessing enum property of generic class
Last modified: 2016-11-30 17:58:00 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.
*** This bug has been marked as a duplicate of bug 774713 ***