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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:51738bb097444dd3ca7adcfa28ae8dcff5a14c50

commit r11-10645-g51738bb097444dd3ca7adcfa28ae8dcff5a14c50
Author: Jason Merrill <ja...@redhat.com>
Date:   Fri Mar 17 17:26:40 2023 -0400

    c++: constant, array, lambda, template [PR108975]

    When a lambda refers to a constant local variable in the enclosing scope,
we
    tentatively capture it, but if we end up pulling out its constant value, we
    go back at the end of the lambda and prune any unneeded captures.  Here
    while parsing the template we decided that the dim capture was unneeded,
    because we folded it away, but then we brought back the use in the template
    trees that try to preserve the source representation with added type info.
    So then when we tried to instantiate that use, we couldn't find what it was
    trying to use, and crashed.

    Fixed by not trying to prune when parsing a template; we'll prune at
    instantiation time.

            PR c++/108975

    gcc/cp/ChangeLog:

            * lambda.c (prune_lambda_captures): Don't bother in a template.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/lambda/lambda-const11.C: New test.

Reply via email to