Browse Source

Fixed: union initialization did not work properly

ceriel 30 years ago
parent
commit
56505254c5
1 changed files with 6 additions and 0 deletions
  1. 6 0
      lang/cem/cemcom.ansi/ival.g

+ 6 - 0
lang/cem/cemcom.ansi/ival.g

@@ -220,6 +220,12 @@ gen_tphead(tpp, nest)
 	}
 	if (gen_error) return tpp;
 	if (tp->tp_fund == UNION) {
+		sd = tp->tp_sdef;
+		if (AHEAD == '{' &&
+		    (aggregate_type(sd->sd_type) || 
+		     sd->sd_type->tp_fund == UNION)) {
+			return &(sd->sd_type);
+		}
 		return gen_tphead(&(tp->tp_sdef->sd_type), nest);
 	}
 	p = new_e_stack();