[libcxx-commits] [PATCH] D96742: [libcxx] adds concept `std::assignable_from`

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 4 22:00:59 PST 2021


cjdb added inline comments.


================
Comment at: libcxx/test/std/concepts/lang/assignable.compile.pass.cpp:138
+
+  constexpr auto Result = std::assignable_from<T1&, const T2&>;
+  static_assert(std::assignable_from<T1&, T2&> == Result);
----------------
ldionne wrote:
> Quuxplusone wrote:
> > This `auto` means `bool`, right? I'd like to see `bool` here if that's the intention.
> > (ditto throughout)
> > 
> Nitpicky but +1, I'm not a huge fan of using `auto` for simple types.
Sure, I'll get a patch ready.


================
Comment at: libcxx/test/std/concepts/lang/assignable.compile.pass.cpp:547
+static_assert(!CheckAssignableFromLvaluesAndRvalues<std::vector<int>,
+                                                    std::vector<const int> >());
+static_assert(!CheckAssignableFromLvaluesAndRvalues<
----------------
ldionne wrote:
> Quuxplusone wrote:
> > Here and line 535: is it actually cromulent to create a container with a const (key/element) type? If this is sort of "library IFNDR" then we shouldn't be doing it in tests. But I don't think anything of value would be lost by removing these two lines, anyway, right?
> Hmm, I had missed that indeed but `std::vector<T const>` isn't allowed because `T const` isn't movable. I think we should remove it. @cjdb did you do this in other tests too? If so, we should fix them too.
I'm a bit confused as to why we say that `std::vector<T const>` isn't allowed. It shouldn't be because `T const` isn't movable: that'd mean `std::vector<std::mutex>` is also disallowed (and as frustrating as it is to use, that type works "fine").


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96742



More information about the libcxx-commits mailing list