Re: [PATCH] vec.h: Properly destruct elements in auto_vec auto storage [PR118400]

2025-01-15 Thread Richard Biener
On Wed, 15 Jan 2025, Jakub Jelinek wrote: > Hi! > > For T with non-trivial destructors, we were destructing objects in the > vector on release only when not using auto storage of auto_vec. > > The following patch calls truncate (0) instead of m_vecpfx.m_num clearing, > and truncate takes care of

[PATCH] vec.h: Properly destruct elements in auto_vec auto storage [PR118400]

2025-01-15 Thread Jakub Jelinek
Hi! For T with non-trivial destructors, we were destructing objects in the vector on release only when not using auto storage of auto_vec. The following patch calls truncate (0) instead of m_vecpfx.m_num clearing, and truncate takes care of that destruction: unsigned l = length (); gcc_checki