|
const auto _Not_pred = [&_Orig_pred = *_Pred]<class _Ty1, class _Ty2>(_Ty1&& _Left, _Ty2&& _Right) {
|
|
return !_STD invoke(_Orig_pred, _STD forward<_Ty1>(_Left), _STD forward<_Ty2>(_Right));
|
|
};
|
|
const auto _Rev_not_pred = [&_Orig_pred = *_Pred]<class _Ty1, class _Ty2>(_Ty1&& _Left, _Ty2&& _Right) {
|
|
return !_STD invoke(_Orig_pred, _STD forward<_Ty2>(_Right), _STD forward<_Ty1>(_Left));
|
|
};
|
This is basically the same problem as #2888.
I don't know how to use MSVC-STL-trunk with Compiler Explorer, but the following code should be rejected incorrectly.
#include <ranges>
struct Bool {
Bool& operator!();
Bool() = default;
Bool(const Bool&) = delete;
operator bool() { return true; };
};
int main() {
Bool b;
int x[] = {42};
auto r = std::views::iota(0, 5) | std::views::chunk_by([&](auto, auto) -> Bool& { return b; });
r.begin();
}
STL/stl/inc/ranges
Lines 6258 to 6260 in ef62d3f
STL/stl/inc/ranges
Lines 6272 to 6274 in ef62d3f
This is basically the same problem as #2888.
I don't know how to use MSVC-STL-trunk with Compiler Explorer, but the following code should be rejected incorrectly.