[dmd-internals] ClassInfo for C++ classes in DMD

Jacob Carlborg via dmd-internals dmd-internals at puremagic.com
Thu Jul 7 05:43:14 PDT 2016

> On 07 Jul 2016, at 12:23, Walter Bright via dmd-internals <dmd-internals at puremagic.com> wrote:
> C++ classes have no dynamic type info (i.e. what the most derived class is). But they do have static type info.

What I mean is this:

// first example, unrelated to the DMD codebase

extern(C++) class Foo {}

void main ()
    auto a = new Foo;
    assert(a.classinfo is null);

// second example, somewhere inside the DMD codebase

auto a = new IntegerExp(0);
assert(a.classinfo !is null);

Both of the above assertions pass. My question is why the second assertion pass.

/Jacob Carlborg

More information about the dmd-internals mailing list