[libcxx-commits] [PATCH] D114136: [libc++] Test that our algorithms never copy a user-provided comparator.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 18 07:30:30 PST 2021


Quuxplusone added inline comments.


================
Comment at: libcxx/test/libcxx/algorithms/robust_against_copying_comparators.pass.cpp:120
+    (void)std::is_sorted_until(first, last, Less(&copies)); assert(copies == 0);
+    if (!TEST_IS_CONSTANT_EVALUATED) (void)std::inplace_merge(first, mid, last, Less(&copies)); assert(copies == 0);
+    (void)std::lexicographical_compare(first, last, first2, last2, Less(&copies)); assert(copies == 0);
----------------
ldionne wrote:
> When/where was `TEST_IS_CONSTANT_EVALUATED` introduced? I seem to have missed it, but it certainly looks weird to me.
It came originally from D110598 (at my instigation), but ended up landing yesterday in D113906.
I already know that within 3 years we'll need something finer-grained; I suggested
```
#define TEST_IS_RUNTIME_OR_CXX20 ...  // for guarding code that became constexpr-friendly in '20
#define TEST_IS_RUNTIME_OR_CXX23 ...  // for guarding code that became constexpr-friendly in '23
```
But it'll be easy to search-and-replace this later, as soon as someone needs it, so I figure there's no rush to settle on that prematurely.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114136



More information about the libcxx-commits mailing list