libstdc++-v3/ChangeLog:
* include/std/ranges (take_while_view::begin): Constrain the
const overload further as per LWG 3450.
(take_while_view::end): Likewise.
* testsuite/std/ranges/adaptors/take_while.cc: Add test for LWG
3450.
constexpr auto
begin() const requires range<const _Vp>
+ && indirect_unary_predicate<const _Pred, iterator_t<const _Vp>>
{ return ranges::begin(_M_base); }
constexpr auto
constexpr auto
end() const requires range<const _Vp>
+ && indirect_unary_predicate<const _Pred, iterator_t<const _Vp>>
{ return _Sentinel<true>(ranges::end(_M_base),
std::__addressof(*_M_pred)); }
};
b = ranges::end(v);
}
+void
+test04()
+{
+ // LWG 3450
+ auto v = views::single(1) | views::take_while([](int& x) { return true;});
+ static_assert(ranges::range<decltype(v)>);
+ static_assert(!ranges::range<decltype(v) const>);
+}
+
int
main()
{
test01();
test02();
test03();
+ test04();
}