Duplicated functions not reported?

Jacob Carlborg via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Apr 15 02:17:08 PDT 2017


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.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list