https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108110
--- Comment #3 from David Binderman ---
Reduced C++ code seems to be:
namespace std {
template struct integral_constant {
static constexpr int value = __v;
};
using true_type = integral_constant;
using false_type = integral_constant;
template struct __conditional {
template using type = _Tp;
};
template
using __conditional_t = typename __conditional<_Cond>::type<_If, _Else>;
template struct remove_cv { using type = _Tp; };
template struct remove_reference { using type = _Tp; };
template
struct __decay_selector
: __conditional_t, _Up> {};
template struct decay {
using type = typename __decay_selector<_Tp>::type;
};
template using decay_t = typename decay<_Tp>::type;
template using enable_if_t = _Tp;
template _Tp &&forward(typename remove_reference<_Tp>::type &);
long max(long __b) {
if (__b)
return __b;
}
} // namespace std
enum layout_type { row_major };
template struct svector {
using size_type = long;
using value_type = long;
using const_reference = value_type;
const_reference operator[](size_type) const;
long *m_begin;
};
template
auto svector::operator[](size_type idx) const -> const_reference {
return m_begin[idx];
}
template struct xcontainer_inner_types;
template class xarray_container;
template
using xarray = xarray_container;
template struct xrange {
using size_type = int;
xrange(size_type, size_type) noexcept;
size_type m_size;
};
template struct xrange_adaptor {
xrange_adaptor(int, int, int) : m_start() {}
std::enable_if_t::value, xrange>
get(long size) {
long __trans_tmp_8, __trans_tmp_7;
if (m_start)
std::max(size);
if (m_stop)
std::max(size);
return xrange(__trans_tmp_7, __trans_tmp_8);
}
int m_start;
int m_stop;
};
template auto range(A, B stop_val) {
return xrange_adaptor(0, stop_val, int());
}
template struct slice_implementation_getter {
template auto operator()(E e, SL slice, long index) {
return get_slice(e, slice, index, std::integral_constant<1>());
}
template
auto get_slice(E, SL slice, long, std::true_type) {
using int_type = std::decay_t;
return slice < int_type() ?: slice;
}
};
template
struct slice_implementation_getter> {
template auto operator()(E e, SL adaptor, long index) {
const svector __trans_tmp_6 = e.shape();
long __trans_tmp_2 = __trans_tmp_6[index];
return adaptor.get(__trans_tmp_2);
}
};
long get_slice_implementation_index;
template auto get_slice_implementation(E e, SL &&slice) {
slice_implementation_getter> getter;
return getter(e, slice, get_slice_implementation_index);
}
template xrange::xrange(size_type, size_type) noexcept {}
template struct xcontainer {
using derived_type = D;
using inner_types = xcontainer_inner_types;
using inner_shape_type = typename inner_types::inner_shape_type;
constexpr const inner_shape_type &shape() const noexcept;
const derived_type &derived_cast() const &noexcept;
};
template struct xstrided_container : xcontainer {
using base_type = xcontainer;
using typename base_type::inner_shape_type;
const inner_shape_type &shape_impl() const noexcept;
inner_shape_type m_shape;
};
template
constexpr auto xcontainer::shape() const noexcept
-> const inner_shape_type & {
return derived_cast().shape_impl();
}
template
auto xcontainer::derived_cast() const &noexcept -> const derived_type & {
return *static_cast(this);
}
template
auto xstrided_container::shape_impl() const noexcept
-> const inner_shape_type & {
return m_shape;
}
template
struct xcontainer_inner_types> {
using shape_type = SC;
using inner_shape_type = shape_type;
};
template
struct xarray_container
: xstrided_container>> {};
struct xview {
template xview(CTA, FSL);
};
template void make_view_impl(E e, S &&...slices) {
using view_type = xview;
view_type(get_slice_implementation(e, std::forward(slices))...);
}
template void view(E e, S... slices) {
make_view_impl(e, std::forward(slices)...);
}
void TestBody() {
xarray a, arr;
xrange_adaptor __trans_tmp_3 = range(1, 4),
__trans_tmp_4 = range(1, 3);
view(a, 1, __trans_tmp_3);
view(arr, 1, __trans_tmp_4);
}