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 790648 - Variables alone inside () are wrongly interpreted as a cast
Variables alone inside () are wrongly interpreted as a cast
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Parser
0.38.x
Other Linux
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
: 783928 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2017-11-21 03:22 UTC by ricardofantin
Modified: 2018-05-22 15:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Two simple functions that don't compile (212 bytes, text/x-vala)
2017-11-21 03:22 UTC, ricardofantin
Details

Description ricardofantin 2017-11-21 03:22:31 UTC
Created attachment 364091 [details]
Two simple functions that don't compile

In the version 0.36 and 0.38 the vala compiler interpret variables with parenthesis around it as a caster to objects with the same name of the variable.

This doesn't happen in the version 0.34 from Ubuntu 17.04 where the compile works as expected.

Is appended a file with two function that generate errors.

The functions:
int posix_wexitstatus(int status) {
            return (((status) & 0xff00) >> 8);
}

int multiplication(int a, int b){
        double alpha = 0.5;
        return (alpha)*a*b;
}

The errors:
bug.vala:3.16-3.21: error: The type name `status' could not be found
            return (((status) & 0xff00) >> 8);
                      ^^^^^^
bug.vala:8.10-8.14: error: The type name `alpha' could not be found
        return (alpha)*a*b;
                ^^^^^
Compilation failed: 2 error(s), 0 warning(s)
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

In both cases (status) and (alpha) were previously instantiated and declared as int and double respectively.
Comment 1 Rico Tzschichholz 2017-11-21 08:13:18 UTC
*** Bug 783928 has been marked as a duplicate of this bug. ***
Comment 2 GNOME Infrastructure Team 2018-05-22 15:56:56 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/604.