[Issue 13867] Overriding a method from an extern(C++) interface requires extern(C++) on the method definition

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 26 09:26:10 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=13867

--- Comment #1 from nick <nicolas.jinchereau at gmail.com> ---
+1 for allowing extern(C++) interface members to be implemented without
specifying the linkage.

In fact, I believe it is a bug for this not to be the case.

Consider this example:

interface A {
    void foo(); 
}

extern(C++) interface B {
    void foo();
}

class Test : A, B {
    void foo() { }
    extern(C++) void foo(){}
}

void main() {
    Test test = new Test();
    test.foo();            // error: ambiguous call to 'foo'
}

I believe the fact that the above example would compile fine if 'extern(C++)'
was removed reinforces this point.

I think this should be changed to a bug.

--


More information about the Digitalmars-d-bugs mailing list