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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Something that might clarify it:
constexpr int foo (int n)
{
  if constexpr (n)
    return 1;
  else
    return 0;
}
constexpr int x = foo (1);
constexpr int y = foo (0);

This is invalid and rejected not just by G++ but by other compilers too.  And
the thing is the same, when parsing foo, if constexpr needs a constant
expression, and n is not a constant expression at that point, even when it will
be during constexpr evaluation later on.

Reply via email to