| ... | ... | @@ -7468,6 +7468,17 @@ static ImplicitCastMatchResult ir_types_match_with_implicit_cast(IrAnalyze *ira, |
| 7468 | 7468 | } |
| 7469 | 7469 | } |
| 7470 | 7470 | |
| 7471 | // implicit union to its enum tag type |
| 7472 | if (expected_type->id == TypeTableEntryIdEnum && actual_type->id == TypeTableEntryIdUnion && |
| 7473 | (actual_type->data.unionation.decl_node->data.container_decl.auto_enum || |
| 7474 | actual_type->data.unionation.decl_node->data.container_decl.init_arg_expr != nullptr)) |
| 7475 | { |
| 7476 | type_ensure_zero_bits_known(ira->codegen, actual_type); |
| 7477 | if (actual_type->data.unionation.tag_type == expected_type) { |
| 7478 | return ImplicitCastMatchResultYes; |
| 7479 | } |
| 7480 | } |
| 7481 | |
| 7471 | 7482 | // implicit enum to union which has the enum as the tag type |
| 7472 | 7483 | if (expected_type->id == TypeTableEntryIdUnion && actual_type->id == TypeTableEntryIdEnum && |
| 7473 | 7484 | (expected_type->data.unionation.decl_node->data.container_decl.auto_enum || |