[libcxx-commits] [PATCH] D74351: [libcxx][type_traits] Implement C++20 common_ref

Michael Schellenberger Costa via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 12 12:06:45 PST 2020


miscco marked an inline comment as done.
miscco added inline comments.


================
Comment at: libcxx/include/type_traits:2306-2307
+template <class _Tp, class _Up>
+struct __common_reference2<_Tp&, _Up&&, enable_if_t<
+    is_convertible_v<_Up&&, __ll_common_ref<const _Up, _Tp>>>>
+{
----------------
cjdb wrote:
> miscco wrote:
> > cjdb wrote:
> > > Perhaps we should hold off on merging this so we can use `std::convertible_to` instead.
> > I would add that `std::convertible_to` has slightly different semantics too as it has some addtional requires clauses
> Fair. I'd at least encourage the use of a _requires-clause_, since it's demonstrably faster to compile than SFINAE and is being commit for the first time to a concepts-aware compiler.
That sounds reasonable. However, someone could theoretically use a C++20 compiler (aka clang 9) without concept support and that would lead to `<type_traits>` not compiling. 

On the other hand I think that is a very bad use case that should not be suported. Maintainers thoughts?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74351





More information about the libcxx-commits mailing list