https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113083
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The problem occurs only when we declone cdtors and are on a
targetm.cxx.cdtor_returns_this target like ARM.
Decloning causes us to create a thunk calling the "main" ctor:
A*
A::A (A *const this)
{
return A::A (this);
}
'this' is now accepted in constexpr so we evaluate the call into {} and end up
with
{
return *this = {};
}
which is gimplified into
{
A *D.4937;
D.4937 = *this = {};
}
but that means there's a discrepancy: we're converting A to A* and that
crashes.
I wonder if we should refuse to evaluate A::A (this) (returning a pointer) into
{} (not a pointer).