-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
do not require complete object or deleting destructor symbols for abstract classes #10
Comments
|
Looks like this will need to wait for v2. For this testcase: ... Clang emits a reference to However, we can emit them as symbols with value 0 or something similar (that's what GCC puts in the construction vtable today). ... doesn't really explain the problem. |
|
See also http://wg21.link/cwg1658, which means that it is no longer correct in general for emission of an abstract class's destructor to emit references to vbase destructors (for instance, a vbase destructor in a class template doesn't necessarily have a point of instantiation in the same translation unit). |
|
I agree with everything you have to say here. Tagging so that we can easily find this when we start adding v2-recommendation sections to the ABI. |
|
So... it turns out that this is valid: ... and ends up calling the complete object destructor for |
|
It's also necessarily UB, right? So we're not actually obliged to implement it by calling the complete object destructor; we could just call the base constructor (or much worse, of course). |
|
It probably should be UB; I don't think the current language rules say that it is, but we should presumably fix that too :) |
|
Well, we can get started on implementing a runtime global dictionary of object kinds by address if the committee insists. :) |
Given
struct A { virtual ~A() = 0; }; A::~A() {}we seem to require three symbols to be emitted:
_ZN1AD0Ev,_ZN1AD1Ev, and_ZN1AD2Ev(or at least, Clang and GCC both emit all three). Of these, only_ZN1AD2Evcan ever be referenced; the deleting destructor and complete object destructor are not entered into the vtable, and a complete object of typeAcan never be destroyed directly.We should not require an implementation to emit these extra symbols. Note in particular that code must be emitted for the
operator deletecall forD0, which needs whole program analysis (-ffunction-sections, LTO, etc) to remove.The same holds regardless of whether the destructor is virtual (but if not, then there's at least only the complete object destructor symbol to worry about, which can always be an alias to the base subobject destructor symbol).
The text was updated successfully, but these errors were encountered: