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 788964 - Property named "last" causes C compilation to fail
Property named "last" causes C compilation to fail
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Code Generator: GObject
0.38.x
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2017-10-13 20:48 UTC by Michael Gast
Modified: 2017-10-26 06:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
codegen: Avoid possible conflicts with internal property/signal defines (3.08 KB, patch)
2017-10-25 11:12 UTC, Rico Tzschichholz
committed Details | Review

Description Michael Gast 2017-10-13 20:48:09 UTC
Hi,

if a class property last is defined the c compilation fails for classes derived from GLIB.Object
used vala version: Vala 0.38.2

public class Foo : Object {
    public string last { get; set; }
    public static int main(string[] args) {
        return 0;
    }
}

$ valac foo.vala 
foo.vala.c:24:2: Fehler: Redeklaration von Aufzählung »FOO_LAST_PROPERTY«
  FOO_LAST_PROPERTY
  ^~~~~~~~~~~~~~~~~
foo.vala.c:23:2: Anmerkung: Vorherige Definition von »FOO_LAST_PROPERTY« war hier
  FOO_LAST_PROPERTY,
  ^~~~~~~~~~~~~~~~~
error: cc exited with status 256


the part in the created c file:
typedef struct _FooPrivate FooPrivate;
enum  {
	FOO_DUMMY_PROPERTY,
	FOO_LAST_PROPERTY,
	FOO_LAST_PROPERTY
};
Comment 1 Rico Tzschichholz 2017-10-25 11:12:43 UTC
Created attachment 362248 [details] [review]
codegen: Avoid possible conflicts with internal property/signal defines
Comment 2 Rico Tzschichholz 2017-10-26 06:17:26 UTC
Attachment 362248 [details] pushed as 2a481c3 - codegen: Avoid possible conflicts with internal property/signal defines