Message ID | Y9BnmXCZtTgjby2V@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2421544wrn; Tue, 24 Jan 2023 15:20:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsOej2DSD/tvs6gAi6gK8L+GyMOVUS5NfdZ6SoCJEsya3YSsIUVJsGatAguhn+HQV0YigLy X-Received: by 2002:a17:906:4755:b0:877:6845:adda with SMTP id j21-20020a170906475500b008776845addamr25723995ejs.50.1674602449318; Tue, 24 Jan 2023 15:20:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674602449; cv=none; d=google.com; s=arc-20160816; b=vEoybNJ5qAm7RjFm/3BfnzVGPqHMkwZNF/VwH4zwi/5rXYmMLk0LjC3BPOQbSrAPHt yI/0fUYU4e1xiYmJMCZ8lWiKrcggOz+vKtvfuGTntemULFON7Y1fEzyjiJZD0THgOk2V AcZShKvauiFHOm9XvU7DcSN5d4aAkffVP0sWr2VkyljU8NrUt35PbKA9cjWe7jzEo2Xn wMuTTW4k+80XyBYtXBXZt55RIZl20IkQ2835J0+sANdLp64pjbv+8rETn1D7JDXVPUUL mdKTyp9PhieOB1/Ov3Zcp/c/0a94meyF7Y1d6R8ed/OqXUT3pPSohJ2zWy8IhSVGD8ab zLXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:cc:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=b7uWdYb0UsY2BZce/Hxivw0cudpnIt2aQpqCgPkZuHk=; b=LFUTiJ5hDA5xyOnTKHs6OSdoz7Udg9K6qNbO4/Fb/uSoD1S9qWAfFkb+XNZUfGF+1H SuGZ/DnMeV9QnoM6xtjNogEdKWU6V8UN5ND4BJ5c7cg0Xpb0fhBfcty5NmUmWq5hROkH SAxVSEP5h8FHnMZa7G3rgpIRNpgzi8dj7LUVAgN5doZlDDjlaU+JT6LlRkz4k4qS2FqT N3exIrlyR1W4f7F/29jmsmxXK+mc1d/3p70DnIfPeDGEBAPKLq4zZ0KBMegIWtETYz+n ISsORTmm5OpjGMecLM74L3z8mDnf0LllrvhlY7+F5T/d2SO0qOU4mum9CxMeG9E3gE6t NdKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="El05DiY/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id fx13-20020a1709069e8d00b00876a2339b6fsi3530203ejc.25.2023.01.24.15.20.49 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 15:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="El05DiY/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 14025385842B for <ouuuleilei@gmail.com>; Tue, 24 Jan 2023 23:20:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 14025385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674602442; bh=b7uWdYb0UsY2BZce/Hxivw0cudpnIt2aQpqCgPkZuHk=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=El05DiY/3ZHdsvhNqEEpxWIR0GJ8bygj9rImr1q7uRdB9rapVEu/jEpcT0xeSwopD Zoo2RobOPE8Oz3c7EQ9RBqR6Req2oMQfOlTXUkD7ud5oYdqhihkuSez7g6bqX3Qb3u ILJkXPGB/rMTUqCXIB5efRqps5K2oG9mpL2CgCDs= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7ADD03858D28 for <gcc-patches@gcc.gnu.org>; Tue, 24 Jan 2023 23:19:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7ADD03858D28 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-675-hwZTGKf3M9-mR5i-v81b3A-1; Tue, 24 Jan 2023 18:19:57 -0500 X-MC-Unique: hwZTGKf3M9-mR5i-v81b3A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2FB53C02184 for <gcc-patches@gcc.gnu.org>; Tue, 24 Jan 2023 23:19:56 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.223]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6D5631121330; Tue, 24 Jan 2023 23:19:56 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 30ONJsH22646064 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 25 Jan 2023 00:19:54 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 30ONJrFq2646061; Wed, 25 Jan 2023 00:19:53 +0100 Date: Wed, 25 Jan 2023 00:19:53 +0100 To: Jason Merrill <jason@redhat.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] c++: Fix up mangling of static lambdas [PR108525] Message-ID: <Y9BnmXCZtTgjby2V@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Jakub Jelinek via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755947937786655074?= X-GMAIL-MSGID: =?utf-8?q?1755947937786655074?= |
Series |
c++: Fix up mangling of static lambdas [PR108525]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Jan. 24, 2023, 11:19 p.m. UTC
Hi! Before the P1169R4 changes, operator () of a lambda was always a method, so it was fine to pass method_p = 1 unconditionally, but it isn't always the case, so this patch adds a check for whether it is a method or nor. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-01-25 Jakub Jelinek <jakub@redhat.com> PR c++/108525 * mangle.cc (write_closure_type_name): Don't assume all lambda operator() fns are methods. * g++.dg/cpp23/static-operator-call5.C: New test. Jakub
Comments
On 1/24/23 18:19, Jakub Jelinek wrote: > Hi! > > Before the P1169R4 changes, operator () of a lambda was > always a method, so it was fine to pass method_p = 1 unconditionally, > but it isn't always the case, so this patch adds a check for whether > it is a method or nor. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. > 2023-01-25 Jakub Jelinek <jakub@redhat.com> > > PR c++/108525 > * mangle.cc (write_closure_type_name): Don't assume all > lambda operator() fns are methods. > > * g++.dg/cpp23/static-operator-call5.C: New test. > > --- gcc/cp/mangle.cc.jj 2023-01-16 11:52:16.000000000 +0100 > +++ gcc/cp/mangle.cc 2023-01-24 18:59:09.335156301 +0100 > @@ -1816,7 +1816,7 @@ write_closure_type_name (const tree type > if (abi_warn_or_compat_version_crosses (18)) > G.need_abi_warning = true; > > - write_method_parms (parms, /*method_p=*/1, fn); > + write_method_parms (parms, TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE, fn); > write_char ('E'); > if ((LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR (lambda) > != LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR (lambda)) > --- gcc/testsuite/g++.dg/cpp23/static-operator-call5.C.jj 2023-01-24 19:03:21.770469929 +0100 > +++ gcc/testsuite/g++.dg/cpp23/static-operator-call5.C 2023-01-24 19:02:45.224003615 +0100 > @@ -0,0 +1,5 @@ > +// PR c++/108525 > +// { dg-do compile { target c++23 } } > + > +auto b = [](...) static { return 1; }; > +auto foo () { return b (); } > > Jakub >
--- gcc/cp/mangle.cc.jj 2023-01-16 11:52:16.000000000 +0100 +++ gcc/cp/mangle.cc 2023-01-24 18:59:09.335156301 +0100 @@ -1816,7 +1816,7 @@ write_closure_type_name (const tree type if (abi_warn_or_compat_version_crosses (18)) G.need_abi_warning = true; - write_method_parms (parms, /*method_p=*/1, fn); + write_method_parms (parms, TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE, fn); write_char ('E'); if ((LAMBDA_EXPR_SCOPE_SIG_DISCRIMINATOR (lambda) != LAMBDA_EXPR_SCOPE_ONLY_DISCRIMINATOR (lambda)) --- gcc/testsuite/g++.dg/cpp23/static-operator-call5.C.jj 2023-01-24 19:03:21.770469929 +0100 +++ gcc/testsuite/g++.dg/cpp23/static-operator-call5.C 2023-01-24 19:02:45.224003615 +0100 @@ -0,0 +1,5 @@ +// PR c++/108525 +// { dg-do compile { target c++23 } } + +auto b = [](...) static { return 1; }; +auto foo () { return b (); }