function parameter with the same name as a const
@Naheel-Azawy
Submitted by Naheel-Azawy Link to original bug (#785634)
Description
Having the following code:
const string foo = "abcd";
void bar (string foo) { print (@"$foo\n"); }
void main (string[] args) { bar (foo); }
Vala will output:
#define foo "abcd"
void bar (const gchar* foo) { ... }
And gcc will expand the macro to:
void bar (const gchar* "abcd" /* <-- Here you can see the problem */) { ... }
In fact, every foo
will be replaced with "abcd".
I believe that you can solve this simply by letting vala add some special keyword to the constants (eg. #define __const_foo "abcd
)
Version: 0.36.x
Edited by Corentin Noël