Closed
Description
llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h
Lines 46 to 51 in 8dd3bc1
The lambda here should specify the return type as bool
, such as [&](auto&& __e) -> bool
because the type that satisfies boolean-testable
does not necessarily have to be bool
:
#include <algorithm>
const struct Boolean {
Boolean() = default;
Boolean(Boolean&&) = delete;
operator bool() const;
const Boolean& operator!() const;
} boolean;
#ifdef __clang__
static_assert(std::__boolean_testable<Boolean>);
#endif
int main() {
// libc++ rejects
auto it = std::ranges::find_if_not(" ", [&](char) -> auto& { return boolean; });
}