Skip to content

Commit

Permalink
Work around GCC 12 ICE
Browse files Browse the repository at this point in the history
Somehow the changes in this PR triggered an ICE in GCC 12 while compiling `reverse_adaptor`... even though we haven't actually made any changes to it at all (other than changing the name of a function).

It's a mystery, but hopefully no longer a problematic one.
  • Loading branch information
tcbrindle committed Nov 26, 2024
1 parent 872fd8d commit fb4bce7
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions include/flux/adaptor/reverse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct reverse_adaptor : inline_sequence_base<reverse_adaptor<Base>>
using value_type = value_t<Base>;

static constexpr auto first(auto& self) -> cursor_type
requires bounded_sequence<decltype((self.base_))>
{
return cursor_type(flux::last(self.base_));
}
Expand All @@ -64,28 +65,32 @@ struct reverse_adaptor : inline_sequence_base<reverse_adaptor<Base>>

template <typename Self>
static constexpr auto read_at(Self& self, cursor_type const& cur)
-> element_t<decltype((self.base_))>
-> decltype(auto)
requires bidirectional_sequence<decltype((self.base_))>
{
return flux::read_at(self.base_, flux::prev(self.base_, cur.base_cur));
}

template <typename Self>
static constexpr auto read_at_unchecked(Self& self, cursor_type const& cur)
-> element_t<decltype((self.base_))>
-> decltype(auto)
requires bidirectional_sequence<decltype((self.base_))>
{
return flux::read_at_unchecked(self.base_, flux::prev(self.base_, cur.base_cur));
}

template <typename Self>
static constexpr auto move_at(Self& self, cursor_type const& cur)
-> rvalue_element_t<decltype((self.base_))>
-> decltype(auto)
requires bidirectional_sequence<decltype((self.base_))>
{
return flux::move_at(self.base_, flux::prev(self.base_, cur.base_cur));
}

template <typename Self>
static constexpr auto move_at_unchecked(Self& self, cursor_type const& cur)
-> rvalue_element_t<decltype((self.base_))>
-> decltype(auto)
requires bidirectional_sequence<decltype((self.base_))>
{
return flux::move_at_unchecked(self.base_, flux::prev(self.base_, cur.base_cur));
}
Expand All @@ -112,14 +117,12 @@ struct reverse_adaptor : inline_sequence_base<reverse_adaptor<Base>>
}

static constexpr auto size(auto& self) -> distance_t
requires sized_iterable<decltype((self.base_))>
requires sized_iterable<Base>
{
return flux::size(self.base_);
}

static constexpr auto for_each_while(auto& self, auto&& pred) -> cursor_type
requires bidirectional_sequence<decltype((self.base_))> &&
bounded_sequence<decltype((self.base_))>
{
auto cur = flux::last(self.base_);
const auto end = flux::first(self.base_);
Expand Down

0 comments on commit fb4bce7

Please sign in to comment.