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++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0
Date: Fri, 19 Mar 2021 23:29:54 +0000	[thread overview]
Message-ID: <bug-95451-4-GX08XHZeoz@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95451-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:8f9308936cf1df134d5aac1f890eb67266530ab5

commit r10-9477-g8f9308936cf1df134d5aac1f890eb67266530ab5
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Feb 26 10:43:28 2021 +0100

    c++: Fix operator() lookup in lambdas [PR95451]

    During name lookup, name-lookup.c uses:
                if (!(!iter->type && HIDDEN_TYPE_BINDING_P (iter))
                    && (bool (want & LOOK_want::HIDDEN_LAMBDA)
                        || !is_lambda_ignored_entity (iter->value))
                    && qualify_lookup (iter->value, want))
                  binding = iter->value;
    Unfortunately as the following testcase shows, this doesn't work in
    generic lambdas, where we on the auto b = ... lambda ICE and on the
    auto d = lambda reject it even when it should be valid.  The problem
    is that the binding doesn't have a FUNCTION_DECL with
    LAMBDA_FUNCTION_P for the operator(), but an OVERLOAD with
    TEMPLATE_DECL for such FUNCTION_DECL.

    The following patch fixes that in is_lambda_ignored_entity, other
    possibility would be to do that before calling is_lambda_ignored_entity
    in name-lookup.c.

    2021-02-26  Jakub Jelinek  <jakub@redhat.com>

            PR c++/95451
            * lambda.c (is_lambda_ignored_entity): Before checking for
            LAMBDA_FUNCTION_P, use OVL_FIRST.  Drop FUNCTION_DECL check.

            * g++.dg/cpp1y/lambda-generic-95451.C: New test.

    (cherry picked from commit 27f9a87886d48448f83e0e559dcf028b1a4a4ec6)

  parent reply	other threads:[~2021-03-19 23:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-31 14:33 [Bug c++/95451] New: [8/9/10 regression] ICE for lambda capturing this and calling operator() max.kanold@nu-cost.com
2020-05-31 14:39 ` [Bug c++/95451] " max.kanold@nu-cost.com
2020-06-01  8:36 ` [Bug c++/95451] [8/9/10 regression] ICE for lambda capturing this and calling operator() since r8-2720-gf44a8dd56f5bfbd0 marxin at gcc dot gnu.org
2020-06-02  7:32 ` [Bug c++/95451] [8/9/10/11 " rguenth at gcc dot gnu.org
2021-01-14  8:56 ` rguenth at gcc dot gnu.org
2021-02-25 11:51 ` jakub at gcc dot gnu.org
2021-02-25 16:15 ` jakub at gcc dot gnu.org
2021-02-26  9:44 ` cvs-commit at gcc dot gnu.org
2021-02-26  9:48 ` [Bug c++/95451] [8/9/10 " jakub at gcc dot gnu.org
2021-03-12  0:20 ` mpolacek at gcc dot gnu.org
2021-03-12  0:23 ` mpolacek at gcc dot gnu.org
2021-03-18 10:50 ` jakub at gcc dot gnu.org
2021-03-19 23:29 ` cvs-commit at gcc dot gnu.org [this message]
2021-03-20  8:08 ` [Bug c++/95451] [8/9 " jakub at gcc dot gnu.org
2021-04-20 23:33 ` cvs-commit at gcc dot gnu.org
2021-04-22 16:51 ` cvs-commit at gcc dot gnu.org
2021-04-22 17:06 ` jakub at gcc dot gnu.org
2021-12-10 12:20 ` pinskia 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-95451-4-GX08XHZeoz@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).