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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to eric-bugs from comment #1)
> Godbolt link: https://godbolt.org/z/gHnb-G
> 
> Also, my attempt to simplify this failed because clang will not consider
> arguments to constexpr functions to be constexpr. Which, IMHO, is wrong.
> Whether the fault is in the standard or clang, I don't know.

It's not wrong. A constexpr function _can_ be used in a constant expression,
but it can also be used elsewhere, in which case its arguments are not
constants.

constexpr int f(int i) {
  constexpr int j = 2 * i;   // ERROR
  return j;
}

int main(int argc, char**) {
  return f(argc);
}

How can j be a constexpr variable?

Reply via email to