https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
Jakub Jelinek changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #6 from Barry Revzin ---
Ugh, sorry. You guys are right. gcc is correct to reject the example. Bad bug
report.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
Jakub Jelinek changed:
What|Removed |Added
CC||jakub at gcc dot gnu.org,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #4 from Barry Revzin ---
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 c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #3 from Barry Revzin ---
clang is also wrong. p(i) doesn't have to be a constant expression there. The
rule (http://eel.is/c++draft/expr.const#13) is "An immediate invocation shall
be a constant expression." but an expression is only
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #2 from Andrew Pinski ---
clang does a better job of explaining though:
:6:17: error: call to consteval function '(anonymous
class)::operator()' is not a constant expression
if (p(i)) { // <== line 5
^
:19
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803
--- Comment #1 from Andrew Pinski ---
clang fails for the same reason.