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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Agreed, the constinit is irrelevant.
As for constexpr dtors generally, even those can have important side-effects,
and even for the case where the ctor is also constexpr and the var has constant
expression initializer, so to me this looks like dup of PR19661.
We'd need to track in some extra bit if the dtor does something non-trivial and
propagate it from dtors of the elements/bases.
struct X {
  constexpr X () : p (nullptr) {}
  constexpr ~X () { delete p; }
  int *p;
};
int
main ()
{
  static constinit X data;
  data.p = new int;
}

Reply via email to