From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: [PATCH] c++: Fix up mangling of static lambdas [PR108525]
Date: Wed, 25 Jan 2023 00:19:53 +0100 [thread overview]
Message-ID: <Y9BnmXCZtTgjby2V@tucnak> (raw)
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.
--- 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
next reply other threads:[~2023-01-24 23:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 23:19 Jakub Jelinek [this message]
2023-01-25 14:08 ` Jason Merrill
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=Y9BnmXCZtTgjby2V@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
/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).