[PATCH] D48753: [libcxx] Use custom allocator's `construct` in C++03 when available.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 11 17:32:09 PST 2018


vsapsai marked an inline comment as done.
vsapsai added a comment.

In D48753#1323248 <https://reviews.llvm.org/D48753#1323248>, @ldionne wrote:

> 2. Also, before this patch, the allocator's `construct` and `destroy` were NEVER called in C++03, but were called when available in C++11. After this patch, they are called when available in C++03 and in C++11. Is this correct?
>
>   If (2) is true, then I believe this patch is a worthwhile improvement in terms of quality-of-implementation, even though it's not mandated by the spec. People do have custom allocators, and this behavior change between C++03 and C++11 is quite subtle and surprising.


The described situation is correct. And I agree it can be surprising and tricky.

> 1. Just to make sure I understand; this patch has nothing to do with https://reviews.llvm.org/D48342, they are entirely orthogonal. Is this correct?

They are not entirely orthogonal in sense that https://reviews.llvm.org/D48342 doesn't account for difference in allocator behaviour between C++03 and C++11. So it is better to have uniform `construct` behaviour before using it in implementing other fixes.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D48753/new/

https://reviews.llvm.org/D48753





More information about the cfe-commits mailing list