https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104803

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org,
                   |                            |redi at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Sure, the first branch of if consteval is immediate function context and
therefore p(i) at line 5 is not an immediate invocation.
But the p(i) at line 9 is not in an immediate function context and because it
calls an immediate function (operator () of the lambda), it is an immediate
invocation and because i at that point is not constant, it should be rejected.
This is diagnosed during the instantiation of the function template, not during
constant evaluation of the function template.  And IMHO it should be diagnosed
even if you don't cal none_of at all, just instantiate it (if it wouldn't be a
template, even when just parsed).

So yes, I agree clang is buggy because it diagnoses it even on line 5.

Note, I'm not a C++ lawyer, but the consteval and if consteval implementation
was done on the assumption it is like that.

Reply via email to