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 596637 - Postfix operator "++" does not work on array members
Postfix operator "++" does not work on array members
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Arrays
0.7.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-28 17:38 UTC by Michael Trausch
Modified: 2009-09-29 20:20 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Michael Trausch 2009-09-28 17:38:04 UTC
Reported by Jim Nelson <jim@yorba.org> on the Vala mailing list, see the message at http://article.gmane.org/gmane.comp.programming.vala/4245

I have confirmed it.  The following simple program demonstrates the problem:

namespace Test {
  public static int main(string[] args) {
    int[] a = new int[3];
    int current = 0;

    a[current] = 0;
    (a[current])++;

    return(a[current]);
  }
}

The result is:

mbt@zest:~/test/vala$ valac test_array.vala 
test_array.vala:7.5-7.18: error: unsupported lvalue in postfix expression
    (a[current])++;
    ^^^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)

This problem is found in Vala 0.7.7.  Likewise, it seems the prefix "++" does not work either.
Comment 1 Jürg Billeter 2009-09-29 20:20:14 UTC
commit 99ec168d1042c9baa38819805edaadfda2646cd2
Author: Jürg Billeter <j@bitron.ch>
Date:   Tue Sep 29 22:19:18 2009 +0200

    Support postfix operator on array members
    
    Fixes bug 596637.