VT_ENUM types use the .ref member and can be VT_BITFIELD, so we need to copy it as well. Simply do it always.
Unified · Split
| @@ -4058,6 +4058,7 @@ static void gfunc_param_typed(Sym *func, Sym *arg) · 4057 unmodified lines | |||
| 4058 | gen_cast(&type); | 4058 | gen_cast(&type); |
| 4059 | } else if (vtop->type.t & VT_BITFIELD) { | 4059 | } else if (vtop->type.t & VT_BITFIELD) { |
| 4060 | type.t = vtop->type.t & (VT_BTYPE | VT_UNSIGNED); | 4060 | type.t = vtop->type.t & (VT_BTYPE | VT_UNSIGNED); |
| 4061 | type.ref = vtop->type.ref; | ||
| 4061 | gen_cast(&type); | 4062 | gen_cast(&type); |
| 4062 | } | 4063 | } |
| 4063 | } else if (arg == NULL) { | 4064 | } else if (arg == NULL) { |
| @@ -602,11 +602,16 @@ enum test { · 601 unmodified lines | |||
| 602 | E5 = 1000, | 602 | E5 = 1000, |
| 603 | }; | 603 | }; |
| 604 | 604 | ||
| 605 | struct S_enum { | ||
| 606 | enum {E6 = 42, E7, E8} e:8; | ||
| 607 | }; | ||
| 605 | void enum_test() | 608 | void enum_test() |
| 606 | { | 609 | { |
| 607 | enum test b1; | 610 | enum test b1; |
| 608 | /* The following should give no warning */ | 611 | /* The following should give no warning */ |
| 609 | unsigned *p = &b1; | 612 | unsigned *p = &b1; |
| 613 | struct S_enum s = {E7}; | ||
| 614 | printf("enum: %d\n", s.e); | ||
| 610 | printf("enum:\n%d %d %d %d %d %d\n", | 615 | printf("enum:\n%d %d %d %d %d %d\n", |
| 611 | E0, E1, E2, E3, E4, E5); | 616 | E0, E1, E2, E3, E4, E5); |
| 612 | b1 = 1; | 617 | b1 = 1; |