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

            Bug ID: 92480
           Summary: Parameters in consteval functions should be constant
                    expressions.
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: h2+bugs at fsfe dot org
  Target Milestone: ---

Great to see that immediate functions have already landed!

But compiling the following on godbolt with gcc-trunk fails:

consteval int foobar(int i)
{
    static_assert(i > 1);
    return i + 2;
}

int main()
{
    return foobar(3);
}

with

<source>:3:21: error: non-constant condition for static assertion

    3 |     static_assert(i > 1);

      |                   ~~^~~

<source>:3:21: error: 'i' is not a constant expression

But i should be a constant expression inside an immediate function, or not?

Reply via email to