[Issue 19134] [C++] static const y = new Derived(); ->pointer cast from const(Derived) to immutable(void*)** is not supported at compile time

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 27 04:30:34 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19134

--- Comment #4 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/b952c845f77264d40253e2e144625fdb0c301804
Fix Issue 19134

And revert to D vptr semantics in constructors of extern(C++) classes,
i.e., call the most derived override in base constructors. 2.081
introduced a breaking change here, using the most derived override
before the super() call and the current class' afterwards.

The proper mid-term solution is probably to emit fully C++-compatible
constructors for extern(C++) classes, calling the super ctor right at
the start and then blitting vptr and class-specific fields from the
init symbol. extern(C++) classes (and structs) should get an implicit
default ctor (only if there's no other ctor in the class case).
extern(C++) classes could then be allocated and properly constructed via
C++ `new`; struct declarations in C++ headers for extern(C++) structs
wouldn't need to duplicate the field initializers and could simply
declare the default ctor (emitted by the D compiler and blitting the
init symbol).

https://github.com/dlang/dmd/commit/50833f0a98df9ac1f1c78db4dd24743aad300539
Merge pull request #8533 from kinke/fix19134

[stable] Fix Issue 19134 - [C++] static const y = new Derived(); ->pointer cast
from const(Derived) to immutable(void*)** is not supported at compile time
merged-on-behalf-of: Rainer Schuetze <rainers at users.noreply.github.com>

--


More information about the Digitalmars-d-bugs mailing list