On Saturday, 15 April 2017 at 09:17:08 UTC, Jacob Carlborg wrote:
I'm not sure if I'm missing something obvious here, but the
following code compiles and runs:
void foo() {}
void foo() {}
void main() {}
Although if I do call "foo", the compiler will complain that it
matches both versions of "foo".
Is this expected behavior of how function overloading works? Is
it possible to for the compiler to report this error? At least
this example is pretty obvious for a human to see.
It would requires an O(n^2) check per declaration.
Even it is never used.
which would make imports that much more expensive.