Skip to content

Commit

Permalink
Added fixes for building with clang 19 (more strict template matching…
Browse files Browse the repository at this point in the history
… rules)
  • Loading branch information
Mykola Vankovych committed Jan 14, 2025
1 parent ae52796 commit 475bedb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions include/xtensor/xexpression_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,15 @@ namespace xt
using type = xarray<T, L>;
};

#if defined(__GNUC__) && (__GNUC__ > 6)
#if __cplusplus == 201703L
// Workaround for rebind_container problems when C++17 feature is enabled
#ifdef __cpp_template_template_args
template <template <class, std::size_t, class, bool> class S, class X, std::size_t N, class A, bool Init>
struct xtype_for_shape<S<X, N, A, Init>>
{
template <class T, layout_type L>
using type = xarray<T, L>;
};
#endif // __cplusplus == 201703L
#endif // __GNUC__ && (__GNUC__ > 6)
#endif // __cpp_template_template_args

template <template <class, std::size_t> class S, class X, std::size_t N>
struct xtype_for_shape<S<X, N>>
Expand Down
4 changes: 2 additions & 2 deletions include/xtensor/xstorage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,8 +1637,8 @@ namespace xt
return !(lhs < rhs);
}

// Workaround for rebind_container problems on GCC 8 with C++17 enabled
#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
// Workaround for rebind_container problems when C++17 feature is enabled
#ifdef __cpp_template_template_args
template <class X, class T, std::size_t N>
struct rebind_container<X, aligned_array<T, N>>
{
Expand Down
3 changes: 2 additions & 1 deletion include/xtensor/xutils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,8 @@ namespace xt
using type = C<X, allocator>;
};

#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
// Workaround for rebind_container problems when C++17 feature is enabled
#ifdef __cpp_template_template_args
template <class X, class T, std::size_t N>
struct rebind_container<X, std::array<T, N>>
{
Expand Down

0 comments on commit 475bedb

Please sign in to comment.