IUnknown and any class derived from it have inconsistent codeview debug info:
dmd -g -c lib
module lib;
interface IUnknown
{
void foo();
}
compiles to
$$TYPES segment
00: LF_ARGLIST argcount=0
01: LF_VTSHAPE count=1 05
02: LF_CLASS count=1 <typidx 1007> property=x0000 <dList 0000> <vshape 1001> length=x0000 lib.IUnknown
03: LF_CLASS count=0 <typidx 0000> property=x0080 <dList 0000> <vshape 0000> length=x0000 IUnknown
04: LF_POINTER <x000a > <typidx 1003>
...
and later referencing the incomplete type 1003. Please note that the class is called "lib.IUnknown" in one entry, but "IUnknown" in the other.
Comment #1 by r.sagitario — 2010-03-27T01:16:14Z
This is caused by using sym->toPrettyChars() most of the time, but sometimes not on cpp-interfaces. I think toPrettyChars() should always be used. Here's a patch:
Index: toctype.c
===================================================================
--- toctype.c (revision 419)
+++ toctype.c (working copy)
@@ -381,8 +381,12 @@
/* Need this symbol to do C++ name mangling
*/
- const char *name = sym->isCPPinterface() ? sym->ident->toChars()
- : sym->toPrettyChars();
+ const char *name = sym->toPrettyChars();
s = symbol_calloc(name);
s->Sclass = SCstruct;
s->Sstruct = struct_calloc();