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 621787 - Don't allow modifications of temporary struct values
Don't allow modifications of temporary struct values
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Structs
0.35.x
Other All
: Normal normal
: 1.0
Assigned To: Vala maintainers
Vala maintainers
accepts-invalid
Depends on:
Blocks:
 
 
Reported: 2010-06-16 14:14 UTC by Aaron Andersen
Modified: 2018-05-22 13:38 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Aaron Andersen 2010-06-16 14:14:52 UTC
public struct Vector3 {
    public float x;
    public float y;
    public float z;
}

public class Foo {
    public Vector3 position {
        get;
        set;
    }

    public Foo () {
    }
}

int main (string[] args) {
    var f = new Foo ();

    // both of these compile fine in vala, 
    // but generate c code which will not compile
    f.position.x++;
    f.position.x = 10.0f;

    return 0;
}
Comment 1 Jürg Billeter 2010-10-16 10:57:25 UTC
This is invalid code, Vala should not allow modifications of temporary struct values. The test case actually compiles now, however, it modifies temporary variables which is probably not what you intended.
Comment 2 GNOME Infrastructure Team 2018-05-22 13:38:01 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/107.