On 9/20/25 2:25 PM, Eczbek wrote:
Or shorten to FUNCTION_FIRST_USER_PARMTYPE (fn_[ab]).

Jason

Thanks!

-- >8 --

 From d4613869df103ba461ca268c8a803ad529f479ba Mon Sep 17 00:00:00 2001
From: Eczbek <eczbek.v...@gmail.com>
Date: Sat, 20 Sep 2025 08:58:00 -0400
Subject: [PATCH] c++: Fix lambdas with variadic parameters and static
  specifier [PR119048]

     PR c++/119048

gcc/cp/ChangeLog:

     * lambda.cc (compare_lambda_sig): Only skip first parameter for
     object members.

gcc/testsuite/ChangeLog:

     * g++.dg/cpp23/static-operator-call8.C: New test.

Signed-off-by: Eczbek <eczbek.v...@gmail.com>

Applied, thanks!

I'm not familiar with this identity, so I can't accept the Signed-off-by, but the change is small enough to be insignificant for copyright so I pushed it on that basis.

If you want to contribute larger patches under a pseudonym that isn't known in the GCC community, please file a copyright assignment with the FSF.

https://gcc.gnu.org/contribute.html#legal

Thanks again,
Jason

---
  gcc/cp/lambda.cc                                   | 4 ++--
  gcc/testsuite/g++.dg/cpp23/static-operator-call8.C | 6 ++++++
  2 files changed, 8 insertions(+), 2 deletions(-)
  create mode 100644 gcc/testsuite/g++.dg/cpp23/static-operator-call8.C

diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc
index 711e3b7a18e..bb0aa7d0a02 100644
--- a/gcc/cp/lambda.cc
+++ b/gcc/cp/lambda.cc
@@ -1742,8 +1742,8 @@ compare_lambda_sig (tree fn_a, tree fn_b)
        || fn_b == error_mark_node)
      return false;

-  for (tree args_a = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn_a))),
-     args_b = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn_b)));
+  for (tree args_a = FUNCTION_FIRST_USER_PARMTYPE (fn_a),
+     args_b = FUNCTION_FIRST_USER_PARMTYPE (fn_b);
         args_a || args_b;
         args_a = TREE_CHAIN (args_a), args_b = TREE_CHAIN (args_b))
      {
diff --git a/gcc/testsuite/g++.dg/cpp23/static-operator-call8.C b/gcc/ testsuite/g++.dg/cpp23/static-operator-call8.C
new file mode 100644
index 00000000000..46aa6b42ce8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/static-operator-call8.C
@@ -0,0 +1,6 @@
+// PR c++/119048
+// { dg-do compile { target c++23 } }
+
+int main() {
+    [] {}, [](...) static {};
+}

Reply via email to