[Bug c++/88761] [8/9 Regression] ICE in tsubst_copy, at cp/pt.c:15478 when chaining lambda calls & fold-expressions

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Feb 2 04:21:00 GMT 2019


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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Sat Feb  2 04:21:06 2019
New Revision: 268471

URL: https://gcc.gnu.org/viewcvs?rev=268471&root=gcc&view=rev
Log:
        PR c++/88761 - ICE with reference capture of constant.

Here, we capture nf, then the use of the proxy decays to a constant during
semantic processing of +nf.  Since we saw some decay from proxy to constant,
we walk through the lambda body to see which proxies are still used, but we
weren't walking into subtrees of DECL_EXPR at all, so we missed the use of
&nf in the initializer of y, and removed the capture.  But then at
instantiation time we try to use nf, don't have a proxy anymore, and ICE.

        * lambda.c (mark_const_cap_r): Do walk subtrees of DECL_EXPR for
        non-proxy decls.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/lambda.c


More information about the Gcc-bugs mailing list