Skip to content

Commit 1a2fd0a

Browse files
authored
xtensor: Fix 0.25.0 build failure with clang 19 (#8544)
* add patch for 0.25.0 * trigger ci for 0.25.0 * fix patch * update xmake.lua, ci works well
1 parent 97d6bad commit 1a2fd0a

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
diff --git a/include/xtensor/xexpression_traits.hpp b/include/xtensor/xexpression_traits.hpp
2+
index 205de67a..61f6620b 100644
3+
--- a/include/xtensor/xexpression_traits.hpp
4+
+++ b/include/xtensor/xexpression_traits.hpp
5+
@@ -103,16 +103,14 @@ namespace xt
6+
using type = xarray<T, L>;
7+
};
8+
9+
-#if defined(__GNUC__) && (__GNUC__ > 6)
10+
-#if __cplusplus == 201703L
11+
+#ifdef __cpp_template_template_args
12+
template <template <class, std::size_t, class, bool> class S, class X, std::size_t N, class A, bool Init>
13+
struct xtype_for_shape<S<X, N, A, Init>>
14+
{
15+
template <class T, layout_type L>
16+
using type = xarray<T, L>;
17+
};
18+
-#endif // __cplusplus == 201703L
19+
-#endif // __GNUC__ && (__GNUC__ > 6)
20+
+#endif // __cpp_template_template_args
21+
22+
template <template <class, std::size_t> class S, class X, std::size_t N>
23+
struct xtype_for_shape<S<X, N>>
24+
diff --git a/include/xtensor/xstorage.hpp b/include/xtensor/xstorage.hpp
25+
index ac179a85..39fb21c6 100644
26+
--- a/include/xtensor/xstorage.hpp
27+
+++ b/include/xtensor/xstorage.hpp
28+
@@ -1638,7 +1638,7 @@ namespace xt
29+
}
30+
31+
// Workaround for rebind_container problems on GCC 8 with C++17 enabled
32+
-#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
33+
+#ifdef __cpp_template_template_args
34+
template <class X, class T, std::size_t N>
35+
struct rebind_container<X, aligned_array<T, N>>
36+
{
37+
diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp
38+
index 137d0e70..d718bdce 100644
39+
--- a/include/xtensor/xutils.hpp
40+
+++ b/include/xtensor/xutils.hpp
41+
@@ -872,7 +872,7 @@ namespace xt
42+
using type = C<X, allocator>;
43+
};
44+
45+
-#if defined(__GNUC__) && __GNUC__ > 6 && !defined(__clang__) && __cplusplus >= 201703L
46+
+#ifdef __cpp_template_template_args
47+
template <class X, class T, std::size_t N>
48+
struct rebind_container<X, std::array<T, N>>
49+
{

packages/x/xtensor/xmake.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ package("xtensor")
1717
add_versions("0.24.0", "37738aa0865350b39f048e638735c05d78b5331073b6329693e8b8f0902df713")
1818
add_versions("0.23.10", "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c")
1919

20+
add_patches("0.25.0", "patches/0.25.0/clang19_build.patch", "b40ef789b39dad40d8f97b73793a5d0377e6165f99a49a8fddde45ff66ed87a2")
21+
2022
add_configs("simd", {description = "Enable SIMD acceleration ", default = true, type = "boolean"})
2123
add_configs("tbb", {description = "Enable parallelization using intel TBB", default = false, type = "boolean"})
2224
add_configs("openmp", {description = "Enable parallelization using OpenMP", default = false, type = "boolean"})

0 commit comments

Comments
 (0)