When an a variant is specified that is the same as the base function the compiler will end up crashing in CodeGen. Give an error instead.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Why is this supposed to be a user error? I don't remember the standard disallowing this and I can see use cases for this.
What's the use case? I wasn't aware of any. We saw it from someone who did it accidently and caused the compiler to crash in codegen.
If you have N overloads/variants and you want to pick the original in a certain condition. It might be easier to specify the condition as match clause with a high score rather than avoid other match clauses to apply then. Put differently, if you disallow this you cannot have a "catch all" variant with a low score, e.g., one that issues a compile or runtime failure if picked.
Even if we don't use this now, we still need to stick somewhat to the standard or open an issue there if we think the behavior should be forbidden.