https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #4 from Barry Revzin <barry.revzin at gmail dot com> ---
For instance, clang accepts this version:
consteval int p(int i) {
return i > 2;
}
constexpr auto none_of(int const* f, int const* l) -> bool {
for (; f != l; ++f) {
int i = *f;
if consteval {
if (p(i)) {
return false;
}
} else {
return false;
}
}
return true;
}
constexpr int vals[] = {1, 0, -1};
static_assert(none_of(vals, vals+3));
But not if you change none_of to be a template (in any way, e.g. taking f and l
as auto).