overloaded extern(C) called without error

Dicebot public at dicebot.lv
Tue Sep 10 07:38:55 PDT 2013


On Tuesday, 10 September 2013 at 14:07:18 UTC, Luís Marques wrote:
> I just realized I wasn't clear -- it calls the (wrong) 
> overloaded function:
>
>     extern(C) void foo(int);
>     extern(C) void foo() { writeln("yes, this is called"); }
>
>     void main()
>     {
>         foo(42);
>     }
>
> outputs:
>
>     yes, this is called

This is why mixing ABI and mangling in one entity is bad. And why 
overloading extern(C) functions is compile-time error in C++.


More information about the Digitalmars-d mailing list