|
|
|
|
|
by flohofwoe
2 days ago
|
|
FWIW it's possible to get rid of the range check via a __builtin_unreachable in the default case (which of course is essentially injected UB): https://www.godbolt.org/z/YTcY3E8hx ...it's actually interesting though that the compiler adds the range check on a 'complete' switch over an enum, because the compiler would complain when a case branch is missing (via a warning). E.g. the frontend is smarter than the backend. |
|