https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104213

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> I'm not sure why a dtor would have a return type other than void or why it 
> would need to return the this pointer

Because that is what is required by the ARM C++ EABI:

>From the PDF on:
https://developer.arm.com/documentation/ihi0041/latest

GC++ABI §3.1.512 Constructor return values
This ABI requires C1 and C2 constructors to return this (instead of being void
functions) so that a C3
constructor can tail call the C1 constructor and the C1 constructor can tail
call C2.
Similarly, we require D2 and D1 to return this so that D0 need not save and
restore this and D1 can tail
call D2 (if there are no virtual bases). D0 is still a void function.
We do not require thunks to virtual destructors to return this. Such a thunk
would have to adjust the
destructor’s result, preventing it from tail calling the destructor, and
nullifying any possible saving.
Consequently, only non-virtual calls of D1 and D2 destructors can be relied on
to return this.

Reply via email to