On Wednesday, 26 September 2012 at 08:37:33 UTC, Jonathan M Davis
wrote:
Then it sounds like this example would probably have to give an
error due to
ambiguity (once you can have multiple alias thises anyway),
because the only
reason that it can be used in the switch statement and cases is
because it
implicitly converts to int or string, and with the switch
statement's
expression and all of the case's expressions being implictly
convertible to
both int and string but not actually being int or string, it's
ambiguous as to
which to convert to.
Agreed.
This should get the same treatment:
void foo(int);
void foo(string);
foo(MyStruct.init); // should be ambiguous