[all-commits] [llvm/llvm-project] fd66b4: [libc++] Add an assertion in the subrange construc...
Louis Dionne via All-commits
all-commits at lists.llvm.org
Fri Sep 3 13:04:25 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: fd66b44ec19e76c111c8a37a42dcb4b44a96bfd6
https://github.com/llvm/llvm-project/commit/fd66b44ec19e76c111c8a37a42dcb4b44a96bfd6
Author: Louis Dionne <ldionne.2 at gmail.com>
Date: 2021-09-03 (Fri, 03 Sep 2021)
Changed paths:
M libcxx/include/__ranges/subrange.h
M libcxx/test/std/ranges/range.utility/range.subrange/primitives.pass.cpp
M libcxx/test/std/ranges/range.utility/range.subrange/types.h
Log Message:
-----------
[libc++] Add an assertion in the subrange constructors with a size hint
Those constructors are very easy to misuse -- one could easily think that
the size passed to the constructor is the size of the range to exhibit
from the subrange. Instead, it's a size hint and it's UB to get it wrong.
Hence, when it's cheap to compute the real size of the range, it's cheap
to make sure that the user didn't get it wrong.
Differential Revision: https://reviews.llvm.org/D108827
More information about the All-commits
mailing list