Why can I call a function with mismatched parameter type?

Andrey Zherikov andrey.zherikov at gmail.com
Fri Dec 11 11:25:22 UTC 2020


Here is the example:
     alias f1 = (string  ) {}; f1(int   .init);
     alias f2 = (string s) {}; f2(int   .init);
     alias f3 = (int     ) {}; f3(string.init);
     alias f4 = (int i   ) {}; f4(string.init);

"f1" case compiles successfully and all others are not (error is 
"is not callable using argument types").

Question is why does f1 case compile?

Furthermore even these do compile:
     f1(float.init);

     struct S{}
     f1(S.init);



More information about the Digitalmars-d-learn mailing list