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 572992 - Compilation error when using 'result' as local variable name for a method returning an array
Compilation error when using 'result' as local variable name for a method ret...
Status: RESOLVED DUPLICATE of bug 469335
Product: vala
Classification: Core
Component: Methods
0.5.x
Other All
: Normal normal
: ---
Assigned To: Jürg Billeter
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2009-02-24 14:58 UTC by Adrián Macías
Modified: 2009-04-14 18:24 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Adrián Macías 2009-02-24 14:58:49 UTC
Please describe the problem:
When you create a method in Vala that returns an array, creating a local variable named 'result' makes the C compilation to fail, stating that result_length1 is already declared.

Steps to reproduce:
1. Create a method returning an array with a result variable, like this one:
int[] get_array()
{
    int[] result = {0, 1, 2};

    return result;
}

2. Compile the source
3. You get an error message stating a redeclared variable



Actual results:
valac returns the following message:

bug01.c: In function ‘get_array’:
bug01.c:14: error: ‘result_length1’ redeclared as different kind of symbol
bug01.c:11: error: previous definition of ‘result_length1’ was here
bug01.c:22: error: invalid type argument of ‘unary *’ (have ‘gint’)
error: cc exited with status 256
Compilation failed: 1 error(s), 0 warning(s)


Expected results:


Does this happen every time?
Yes

Other information:
Comment 1 Jürg Billeter 2009-04-14 18:24:41 UTC
Thanks for taking the time to report this bug.
This particular bug has already been reported into our bug tracking system, but we are happy to tell you that the problem has already been fixed. It should be solved in the next software version. You may want to check for a software upgrade.


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