[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-07 Thread barry.revzin at gmail dot com via Gcc-bugs
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.

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-07 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org,

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread barry.revzin at gmail dot com via Gcc-bugs
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

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread barry.revzin at gmail dot com via Gcc-bugs
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

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
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

[Bug c++/104803] if consteval error from branch that isn't evaluated anyway

2022-03-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803 --- Comment #1 from Andrew Pinski --- clang fails for the same reason.