Feedback Thread: DIP 1044--Enum Type Inference--Community Review Round 1
H. S. Teoh
hsteoh at qfbox.info
Fri Nov 18 21:37:36 UTC 2022
On Friday, 18 November 2022 at 21:29:15 UTC, Walter Bright wrote:
> The following is not addressed:
>
> enum E { e };
> int e;
> auto x = e; // which e?
IMO, the rule should be that if `e` has multiple possible
candidates, ETI should be prohibited, and you have to explicitly
spell out `E.e`. So in this case `e` should resolve to the int,
not to the enum.
> void bahb(int);
> void bahb(E);
> bahb(e); // which bahb?
Hmm, now this is problematic. My gut feeling wants to say the
int should be preferred, but how to resolve this in a consistent
way across all cases is much less obvious, and the implementation
is also not obvious.
More information about the Digitalmars-d
mailing list