[libcxx-commits] [PATCH] D130835: [libc++] Fix a hard error in `contiguous_iterator<NoOperatorArrowIter>`.
Konstantin Varlamov via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jul 31 18:27:29 PDT 2022
var-const added inline comments.
================
Comment at: libcxx/include/__memory/pointer_traits.h:197
template <class _Pointer, class = __enable_if_t<
- !is_pointer<_Pointer>::value && !is_array<_Pointer>::value && !is_function<_Pointer>::value
+ _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
> >
----------------
This is more to start a discussion. Would it be easier to list what the `_Pointer` could be rather than what it should *not* be? Are there any other alternatives rather than a class that we would accept here?
================
Comment at: libcxx/include/__memory/pointer_traits.h:197
template <class _Pointer, class = __enable_if_t<
- !is_pointer<_Pointer>::value && !is_array<_Pointer>::value && !is_function<_Pointer>::value
+ _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value
> >
----------------
var-const wrote:
> This is more to start a discussion. Would it be easier to list what the `_Pointer` could be rather than what it should *not* be? Are there any other alternatives rather than a class that we would accept here?
`_And` is necessary because `enable_if` doesn't short-circuit, so it would still try to evaluate `_IsFancyPointer` on e.g. an array, leading to a hard error when trying to instantiate `pointer_traits<array-type>`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130835/new/
https://reviews.llvm.org/D130835
More information about the libcxx-commits
mailing list