Closed marehr closed 4 years ago
I reduced it a bit:
#include <iterator>
#include <utility>
namespace ranges {
namespace detail {
template <typename T, typename U>
concept derived_from = __is_base_of(U, T); // works with clang, but fails with gcc
// concept derived_from = requires() { // fails with gcc and clang
// std::is_base_of<U, T>::value;
// typename std::is_base_of<U, T>::type;
// };
template <typename T>
concept pair_like =
derived_from<std::tuple_size<T>, std::integral_constant<std::size_t, 2>>;
} // namespace detail
template <typename I> struct subrange {
template <detail::pair_like PairLike>
operator PairLike();
};
} // namespace ranges
template <typename T> concept view_ = requires(T t) { {(t != t)}; };
int main() {
ranges::subrange<std::istreambuf_iterator<char>>
sub;
view_<decltype(sub)>;
}
I think this is a bug, in the sense, that https://en.cppreference.com/w/cpp/types/is_base_of has the signature
template< class Base, class Derived >
struct is_base_of;
with the requirement:
If both Base and Derived are non-union class types, and they are not the same type (ignoring cv-qualification), Derived shall be a complete type; otherwise the behavior is undefined.
https://godbolt.org/z/lfXk-g