here is very simplified code of problem I have:
enum node_type {
t_int, t_double
};
struct int_node {
int value;
};
struct double_node {
double valu
Well, the solution was to name instance of the union (which can remain anonymous as datatype) and then use that name as a proxy.
$ diff -u old_us.c us.c
--- old_us.c 2010-07-12 13:49:25.000000000 +0200
+++ us.c 2010-07-12 13:49:02.000000000 +0200
@@ -15,7 +15,7 @@
union {
struct int_node int_n;
struct double_node double_n;
- };
+ } data;
};
int main(void) {
@@ -23,6 +23,6 @@
i.value = 10;
struct node n;
n.type = t_int;
- n.int_n = i;
+ n.data.int_n = i;
return 0;
}
Now it compiles as c99 without any problems.
$ cc -std=c99 us.c $
Note: I am not happy about this solution anyway.