[libcxx-commits] [PATCH] D97162: [libcxx] adds std::ranges::swap, std::swappable, and std::swappable_with

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 4 19:32:52 PST 2021

cjdb added inline comments.

Comment at: libcxx/test/std/concepts/lang/swappable_with.compile.pass.cpp:593
Quuxplusone wrote:
> cjdb wrote:
> > ldionne wrote:
> > > EricWF wrote:
> > > > Can we write these tests in a way that makes them non-threading dependent.
> > > > 
> > > I don't think so since he's explicitly trying to exercise these types, which aren't provided when `_LIBCPP_HAS_NO_THREADS`. Better would be to have a test-suite version of the macro (to express the fact that the test suite supports being used when threads are not available), but that's for a different patch.
> > How about I do that patch just before announcing P0898 is implemented?
> Peanut gallery says: Other alternatives include
> - test a made-up `struct Immobile` instead of specifically `std::mutex`; we can assume that `std::mutex` is equally immobile
> - move tests of `std::mutex`'s own properties into test/std/thread/thread.mutex/ (because if someone were somehow to break the immobility of `std::mutex`, I'd hope that it's the //mutex// tests that fail, not some random concept's tests)
> But I have no particular stake in the outcome.
Reason for having `std::mutex` over `immobile` is because @ldionne asked if I could test some standard types too, and I couldn't think of any non-thread based nonmovable types at the time. @EricWF and I agreed to change the `mutex` ones to some streams.

  rG LLVM Github Monorepo



More information about the libcxx-commits mailing list