overloaded extern(C) called without error

deadalnix deadalnix at gmail.com
Wed Sep 11 01:25:59 PDT 2013


On Tuesday, 10 September 2013 at 14:38:56 UTC, Dicebot wrote:
> 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++.

I think this is another form of the unclear qualifier binding 
problem.

Qualifier bind to symbol : mangling.
Qualifier bind to type : calling convention.


More information about the Digitalmars-d mailing list