[PATCH] D17053: [libcxx]: vector: Use < instead of != to improve failure mode
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 6 14:58:14 PDT 2020
dexonsmith abandoned this revision.
dexonsmith added subscribers: ldionne, EricWF.
dexonsmith added a comment.
Herald added a subscriber: ributzka.
In D17053#632700 <https://reviews.llvm.org/D17053#632700>, @EricWF wrote:
> Maybe if we want to improve the failure mode we can add a `_LIBCPP_ASSERT(__new_last <= __end, "invalid range")`?
I suspect this assertion would get optimized out, since if `__new_last > __end` it's undefined behaviour to compare them. Whereas the loop condition won't get optimized away.
@ldionne, pointing you at this in case you have an idea (maybe specializing for raw pointers?), but I'm not planning to move this forward.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D17053/new/
https://reviews.llvm.org/D17053
More information about the cfe-commits
mailing list