https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106093
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #2) > Afterwards, we would actually construct the new element in the new storage, > but the warning happens while just copying the elements from the old storage > to the new. Actually we already created the new element first (vector.tcc:668) and then we copy the old elements (vector.tcc:676). Either way, it's correct that the loop copying the old elements uses the old size.