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

            Bug ID: 87185
           Summary: ICE in prune_lambda_captures()
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: P at draigBrady dot com
  Target Milestone: ---

bug 84726 introduced a regression in GCC 8.0 causing a compiler crash with:

  void f() { const int i=0; [&]() noexcept {i;}; }

This crashes in prune_lambda_captures as we assume const_vars.get(var) in
lambda.c returns non NULL.

The reason it's NULL is that var_to_maybe_prune() is not a subset of
mark_const_cap_r().  Specifically is_constant_capture_proxy() returns false
in mark_const_cap_r(), but in var_to_maybe_prune() we return candidates
where is_normal_capture_proxy() is false.

Also "noexcept" is significant here since it stops traversal
down the statement list subtree, thus not populating const_vars.

Reply via email to