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 775466 - Using a GValue as a generic type when calling a method generates invalid C code
Using a GValue as a generic type when calling a method generates invalid C code
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Generics
0.34.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-12-01 13:03 UTC by bob
Modified: 2016-12-10 12:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
vala: Check inferred generic-types of MemberAccess (2.36 KB, patch)
2016-12-09 18:20 UTC, Rico Tzschichholz
committed Details | Review

Description bob 2016-12-01 13:03:20 UTC
I wrote a simple test case to demonstrate this:

    T test<T> (T param) {
        return param;
    }

    int main (string[] args) {
        test (4);
        test (Value (typeof (int)));
        return 0;
    }

The statement `test (4)` generates properly formed C code as expected, but using a GValue creates the following function call:

    _tmp2_ = test (G_TYPE_VALUE, (GBoxedCopyFunc) , g_value_unset, _tmp1_);

It emits the GBoxedCopyFunc cast but no expression to cast. Unsurprisingly, GCC doesn't like this much and chokes.
Comment 1 Rico Tzschichholz 2016-12-01 13:18:26 UTC

*** This bug has been marked as a duplicate of bug 772204 ***
Comment 2 Rico Tzschichholz 2016-12-01 13:22:27 UTC
Basically the same as https://bugzilla.gnome.org/show_bug.cgi?id=772204
Comment 3 Rico Tzschichholz 2016-12-09 18:20:29 UTC
Created attachment 341687 [details] [review]
vala: Check inferred generic-types of MemberAccess
Comment 4 Rico Tzschichholz 2016-12-10 12:31:14 UTC
Attachment 341687 [details] pushed as eda719e - vala: Check inferred generic-types of MemberAccess