August 02, 2018
https://issues.dlang.org/show_bug.cgi?id=19134

          Issue ID: 19134
           Summary: [C++] static const y = new Derived(); ->pointer cast
                    from const(Derived) to immutable(void*)** is not
                    supported at compile time
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: iamthewilsonator@hotmail.com

https://forum.dlang.org/post/ghusgzuqpcskhwzmlwbh@forum.dlang.org https://run.dlang.io/is/dSVruv

Works in DMD 2.080, regressed in DMD 2.081.

extern(C++) {
    class Base {
        this() {}
        void consumeAVtblSlot() const {}
    }

    class Derived : Base {
        this() {}
    }
}

void main()
{
    static const y = new Y();
}

fails with

Error: pointer cast from const(Y) to immutable(void*)** is not supported at
compile time

commenting out the constructor of X makes compilation succeed. Removing extern C++ makes compilation succeed.

--