Thread overview
[Issue 12613] Diagnostic for calling convention mismatch when implementing/overriding methods should improve
Apr 22, 2014
Andrej Mitrovic
Dec 17, 2022
Iain Buclaw
April 22, 2014
https://issues.dlang.org/show_bug.cgi?id=12613

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Ok so this is a bit weird, in 'InterfaceDeclaration::semantic' COM interfaces are handled like so:

    if (com)
        sc->linkage = LINKwindows;
    else if (cpp)
        sc->linkage = LINKcpp;

But in 'ClassDeclaration::semantic' the code path is different:

    if (isCOMclass())
    {
        if (global.params.isWindows)
            sc->linkage = LINKwindows;
        else
            /* This enables us to use COM objects under Linux and
             * work with things like XPCOM
             */
            sc->linkage = LINKc;
    }

Is this mismatch an oversight or deliberate? It's also the reason why there are no proper diagnostics. There is a check in 'BaseClass::fillVtbl':

    if (fd->linkage != ifd->linkage)
        fd->error("linkage doesn't match interface function");

But the two will match in COM classes because the scope's linkage is modified, not the actual functions themselves.

So what's the best way forward?

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=12613

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=12613

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18817

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--