[libcxx-commits] [PATCH] D130330: [libc++][NFC] Add checks for lifetime issues in classic algorithms.

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 26 15:27:36 PDT 2022


Mordante accepted this revision.
Mordante added a comment.

Thanks for adding the use after move validation!
LGTM when the CI is green.



================
Comment at: libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp:653
+int main(int, char**) {
+  test_all();
+
----------------
var-const wrote:
> Mordante wrote:
> > Do you expect `test_all` to grow? Otherwise it could be folded in main.
> Probably -- I have at least one addition in mind (I also have a personal preference for a very simple `main`).
I prefer a small `main` too, but usually I fold these small helpers in `main`. But no objection against your approach.


================
Comment at: libcxx/test/std/algorithms/robust_against_proxy_iterators_lifetime_bugs.pass.cpp:551
+
+  test(simple_in, [&](I b, I e) { std::any_of(b, e, is_neg); });
+  test(simple_in, [&](I b, I e) { std::all_of(b, e, is_neg); });
----------------
var-const wrote:
> Mordante wrote:
> > var-const wrote:
> > > I don't know of a good way to pass a pointer to a template function, so unlike similar tests for range algorithms I'm using lambdas here.
> > You mean a pointer to `std::any`?
> I think using `any` here would prevent running this test in pre-C++17 modes, right? (good idea, though)
sorry I meant `std::any_of`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D130330



More information about the libcxx-commits mailing list