https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127386
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 65906 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=65906&action=edit gcc17-pr127386-wip.patch My current WIP plan is to mark EXPR_STMTs inside of the constructor which mark the beginning/end of initialization of a particular subobject (either through calling a constructor on it or doing INIT_EXPR on those) with 2 new flags and then (still unimplemented) during constant evaluation of the constructor use a new flag that we are in the process of constructing the CONSTRUCTOR and when evaluating the EXPR_STMTs with those flags simply note e.g. in the values hash_map what is the current state (i.e. which subobject is being initialized right now). And when the new CONSTRUCTOR flag is set on a CONSTRUCTOR, look it up and from that figure out what is within lifetime and what is not. Note, there can be several passes during that construction, one is construction of virtual bases (if any), one is construction of other bases (if any) and last are mem-initializers, so depending on which FIELD_DECL we want to track lifetime info on we'll need to take that into account.
