| ... | @@ -2469,6 +2469,13 @@ or | ... | @@ -2469,6 +2469,13 @@ or |
| 2469 | </p> | 2469 | </p> |
| 2470 | {#code|test_union_method.zig#} | 2470 | {#code|test_union_method.zig#} |
| 2471 | | 2471 | |
| | 2472 | <p> |
| | 2473 | Unions with inferred enum tag types can also assign ordinal values to their inferred tag. |
| | 2474 | This requires the tag to specify an explicit integer type. |
| | 2475 | {#link|@intFromEnum#} can be used to access the ordinal value corresponding to the active field. |
| | 2476 | </p> |
| | 2477 | {#code|test_tagged_union_with_tag_values.zig#} |
| | 2478 | |
| 2472 | <p> | 2479 | <p> |
| 2473 | {#link|@tagName#} can be used to return a {#link|comptime#} | 2480 | {#link|@tagName#} can be used to return a {#link|comptime#} |
| 2474 | {#syntax#}[:0]const u8{#endsyntax#} value representing the field name: | 2481 | {#syntax#}[:0]const u8{#endsyntax#} value representing the field name: |