[libcxx-commits] [libcxx] [libc++] Make std::allocator always trivially default constructible (PR #169914)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 8 08:51:25 PST 2025


https://github.com/ldionne requested changes to this pull request.

I think this is reasonable. If a type was previously non-trivial, code would call its constructor explicitly in order to be correct. So if we switch to not requiring these calls to be made, that should be correct.

This also doesn't impact whether a type is considered trivial for the purpose of calls, so there's no ABI impact on that side of things.

Basically, I think this can only break if someone is relying on `std::is_trivial` for changing the layout of their own type, and it should be a rare occurrence for this to happen for `std::allocator`. I expect it might happen for a container type, but as you said, the container type itself is probably non-trivial already due to other reasons, so this patch doesn't change anything.

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


More information about the libcxx-commits mailing list