<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/69074>69074</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
`<algorithm>`: `ranges::find_if_not`'s help lambda should return `bool`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hewillk
</td>
</tr>
</table>
<pre>
https://github.com/llvm/llvm-project/blob/8dd3bc18081657fee2352cf5b1c6abacb18fcc84/libcxx/include/__algorithm/ranges_find_if_not.h#L46-L51
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`:
```cpp
#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; });
}
```
https://godbolt.org/z/4M15cvarx
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM2SqzgPfRqxUXXKyOEnCxadTrO63-7bU7YRwTNunMKmb_c8_RQ_Cbm3ZhZTRSUg5CPpcI5UCPY6MFeQnSG7JGqKvR-rnn9a5_5MtG-_qz7GWwD5ClQD1Vcb-0kfjP8Aqp37vP-93Eb_B5sIVGvnNVBdtq3UJi1FmeZZ0TGTzMh0mU5NrrQyOi07Y8rjDGC1-foCqu1g3NQyUN00yl39aGM_VxjVcOXQdHZoG9s1g4-HHkj-OOYvP7IUxAXE6_r7_57RqQ_dKux5ZAy9n1yL4cbGdt8Ye8aR4zQOGL9vjCog5EJ77yAXQG8YJtNv0ZkTyiG7AJVqin5-oBybhoFO-ALyHbeDqNmoKfACv-DGXkUMKtrQWQ7YbEVYDS-RQ1TaMeSiwdZzwMFHHNhwCGq07ht79ckYPWp-bk6-Ps85R5bL3G5bhORGH4J829mT78_njB9CxBDHyUQ8ry0hFOf1Ld5DQOU8JMgLttypyUWQ95w95XGXL9c933HkPR39jUcV_biytQIvbTzlrG3teI9DQOk_HoHighuje-zBQ9dyh01jnBquTbPGQ1TRmkaFwGMEKkNsZ07la9NsQM3j08i3eyvyHei0VyDJQ2u753p2iPih7IOyncvVMTirG-gMdMaRZ4-Ee8KsKrRxoe3Rzqr19f5J8As8IRDNMn3WpunV-FDkJtS5jbvQd5oQissv4xSX39S0Pv5med9q7-LBj1eg-i-g-vi_NDOfavxK2kq2J3lSCVdpfiqkKApRJH2VSSGLQrRFpgvTnoQySlBWclYWyug8TWxFgmQq0mNaUnrMDkJIMm2WsdKpOpUdHAV_KOsO83aZayc2hImr_CSKY-KUZheWtUU08E9cXs7kZJdkrJaNpKdrgKNwNsSwo0QbHVeLoX41yWKx2XD_9gHmBVEE7Nnd7itm2y4b0btZk2l0_31xLjMEoHqZ8e8AAAD__45esBg">