[libcxx-commits] [libcxx] [libc++] Add an ABI setting to harden unique_ptr<T[]>::operator[] (PR #91798)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 14 12:22:59 PDT 2024


jkorous-apple wrote:

> > I actually think the compiler knows the size of the allocation cause it encodes it at the front of the allocation
> 
> Only when the element type has a non-trivial destructor.

That sounds like for such types we could use it for runtime check in `operator[]` without changing the layout. Is that right?
Do you see any catch?


https://github.com/llvm/llvm-project/pull/91798


More information about the libcxx-commits mailing list