public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108829] [12 Regression] internal compiler error: in is_capture_proxy, at cp/lambda.cc:272
Date: Mon, 20 Feb 2023 17:27:34 +0000	[thread overview]
Message-ID: <bug-108829-4-vh1dFxhMXA@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108829-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:12cdc0e266f02c3ba4e80c3d971463ff507e049b

commit r12-9191-g12cdc0e266f02c3ba4e80c3d971463ff507e049b
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Feb 16 17:41:24 2023 -0500

    c++: ICE with redundant capture [PR108829]

    Here we crash in is_capture_proxy:

      /* Location wrappers should be stripped or otherwise handled by the
         caller before using this predicate.  */
      gcc_checking_assert (!location_wrapper_p (decl));

    We only crash with the redundant capture:

      int abyPage = [=, abyPage] { ... }

    because prune_lambda_captures is only called when there was a default
    capture, and with [=] only abyPage won't be in LAMBDA_EXPR_CAPTURE_LIST.

    The problem is that LAMBDA_CAPTURE_EXPLICIT_P wasn't propagated
    correctly and so var_to_maybe_prune proceeded where it shouldn't.

    Co-Authored by: Patrick Palka <ppalka@redhat.com>

            PR c++/108829

    gcc/cp/ChangeLog:

            * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
            (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
            prepend_one_capture.

    gcc/testsuite/ChangeLog:

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

    (cherry picked from commit 02d8ab3e4e2f3d9dc12157a98c976d6698e71e29)

  parent reply	other threads:[~2023-02-20 17:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 18:42 [Bug c++/108829] New: " v.barinov at samsung dot com
2023-02-16 18:43 ` [Bug c++/108829] " v.barinov at samsung dot com
2023-02-16 18:46 ` mpolacek at gcc dot gnu.org
2023-02-16 18:48 ` [Bug c++/108829] [13 Regression] " pinskia at gcc dot gnu.org
2023-02-16 18:49 ` pinskia at gcc dot gnu.org
2023-02-16 18:50 ` [Bug c++/108829] [12/13 " pinskia at gcc dot gnu.org
2023-02-16 18:55 ` mpolacek at gcc dot gnu.org
2023-02-20 14:18 ` cvs-commit at gcc dot gnu.org
2023-02-20 15:48 ` [Bug c++/108829] [12 " mpolacek at gcc dot gnu.org
2023-02-20 17:27 ` cvs-commit at gcc dot gnu.org [this message]
2023-02-20 17:28 ` mpolacek at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108829-4-vh1dFxhMXA@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).