Spec: can a class method change the type of the object (vtable) ?

Johan j at j.nl
Mon Mar 18 20:09:47 UTC 2024


On Monday, 18 March 2024 at 13:50:59 UTC, kinke wrote:
> The only exception might be `extern(C++)` ctors in the future, 
> if we really made those C++-compatible - they set the vptr 
> (base ctors first to their vptr, then derived ctors overriding 
> it later).

Any extern(C++) method is not safe, because C++ allows placement 
new on `this` (a known issue for devirtualizing in C++). And 
indeed during construction things are particularly tricky in C++.

-Johan




More information about the Digitalmars-d mailing list