GNOME Bugzilla – Bug 530063
enum definition should appear before struct using that enum in C code
Last modified: 2008-05-31 11:43:00 UTC
Try compiling example below public class Sample { enum Enum { A } struct Struct { Enum a; } static int main (string[] args) { return 0; } } Generated code contains struct _SampleStruct { SampleEnum a; }; typedef enum { SAMPLE_ENUM_A } SampleEnum; while this should be typedef enum { SAMPLE_ENUM_A } SampleEnum; struct _SampleStruct { SampleEnum a; };
Created attachment 109965 [details] [review] Patch making sure that enums are defined before structs in a class
Jürg, can I commit the patch above?
Thanks for the patch, however, this is just a symptom of a different bug, which I want to fix this in a more general manner. I have an experimental patch in a local branch, can hopefully commit it soon.
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of 471244 ***
More general fix for bug 571244 is taking too long, let's first address the specific issue you have here.
That should have been bug 471244, of course.
2008-05-31 Jürg Billeter <j@bitron.ch> * vala/valaclass.vala: * vala/valainterface.vala: Emit nested enums before structs, based on patch by Jaap A. Haitsma, fixes bug 530063 Fixed in r1514.
Thanks :-)