[Bug libstdc++/124121] Missed optimization in initialization of std::inplace_vector with std::initializer_list

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Thu Feb 19 14:46:56 GMT 2026


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

--- Comment #15 from rguenther at suse dot de <rguenther at suse dot de> ---
On Thu, 19 Feb 2026, redi at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124121
> 
> --- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
> (In reply to rguenther@suse.de from comment #6)
> > OK, but why would you need that asm() barrier there then?  What's
> > the semantic of a started lifetime of something with undefined state?
> 
> Exactly that: a started lifetime, so that for the purposes of the abstract
> machine you're not accessing an object outside its lifetime.
> 
> > Wasn't std::start_lifetime_as supposed to view a defined bit pattern
> > as a differnet type?
> 
> That's bit_cast. start_lifetime_as just tells the compiler that there is an
> object there within its lifetime, without accessing the bits or saying anything
> about their values.

But the container is there already, so I'm confused ... and you
are not accessing the lifetime started object because you never
initialized it and it will start lifetime at the time you
placement new it?


More information about the Gcc-bugs mailing list