-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Remove runtime coercion of enums to unions #12480
Copy link
Copy link
Open
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Milestone
Metadata
Metadata
Assignees
Labels
frontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This issue suggests language modifications. If it also has the "accepted" label then it is planned.
Continued from #12462 (comment)
This feature is of questionable usefulness since it is only valid for unions with all zero bit type fields which are quite rare. It is not used anywhere in the std, the self hosted compiler or even in the behavior tests and probably not in any third party project. It could be made more useful by turning the compile error into runtime safety checks but that could be seen as too implicit with the preferred way to handle it being a switch: