[Issue 12613] Diagnostic for calling convention mismatch when implementing/overriding methods should improve
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue Apr 22 07:48:44 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12613
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at 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?
--
More information about the Digitalmars-d-bugs
mailing list