GNOME Bugzilla – Bug 572992
Compilation error when using 'result' as local variable name for a method returning an array
Last modified: 2009-04-14 18:24:41 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:
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 ***