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

            Bug ID: 117435
           Summary: [contracts] capture of a function parm in a lambda in
                    a contract does not work
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: c++-contracts, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

void f2 (int x) [[pre: []{return x;}()]] {}

int main ()
{

  f2 (5);
}


ICES with:
during RTL pass: expand
l.C: In lambda function:
l.C:17:34: internal compiler error: in expand_expr_real_1, at expr.cc:11415
   17 | void f2 (int x) [[pre: []{return x;}()]] {}

It would seem that x is not captured, and that is probably because at the point
the lambda is parsed, f2() has not started and therefore the lambda is not
counted as nested (tentative analysis).

Reply via email to