From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2122) id 1BB09385086C; Tue, 7 Mar 2023 19:34:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1BB09385086C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678217658; bh=97K3mLSB/yHPi4UYPDqHEPxWtg2saaAjK+NspxqrFgo=; h=From:To:Subject:Date:From; b=Be71Ef1SOol7f08vvFJrBEm36uUIoJjEXDRvWMhxY/ECw96yQ27wZAcPovlvnlyFb DfGHCoJybs28dkAhf1okUDf3ZMnCAvY/Fyt3uLQIu+ys9+kKmbqLilm/LIW2tO4BZv uKOc0kyNMoPL7ZJxBbWdFFeWYxsOOt3wzq8BcNIU= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jason Merrill To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-6533] c++: static lambda tsubst [PR108526] X-Act-Checkin: gcc X-Git-Author: Jason Merrill X-Git-Refname: refs/heads/trunk X-Git-Oldrev: f875857e008c4415c32d2f15e88f04c3e42719ea X-Git-Newrev: 4f181f9c7ee3efc509d185fdfda33be9018f1611 Message-Id: <20230307193418.1BB09385086C@sourceware.org> Date: Tue, 7 Mar 2023 19:34:18 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4f181f9c7ee3efc509d185fdfda33be9018f1611 commit r13-6533-g4f181f9c7ee3efc509d185fdfda33be9018f1611 Author: Jason Merrill Date: Mon Mar 6 21:36:28 2023 -0500 c++: static lambda tsubst [PR108526] A missed piece of the patch for static operator(): in tsubst_function_decl, we don't want to replace the first parameter with a new closure pointer if operator() is static. PR c++/108526 PR c++/106651 gcc/cp/ChangeLog: * pt.cc (tsubst_function_decl): Don't replace the closure parameter if DECL_STATIC_FUNCTION_P. gcc/testsuite/ChangeLog: * g++.dg/cpp23/static-operator-call5.C: Pass -g. Diff: --- gcc/cp/pt.cc | 4 ++-- gcc/testsuite/g++.dg/cpp23/static-operator-call5.C | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 85136df1730..aafc99d12c3 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -14393,12 +14393,12 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, DECL_NAME (r) = make_conv_op_name (TREE_TYPE (type)); tree parms = DECL_ARGUMENTS (t); - if (closure) + if (closure && !DECL_STATIC_FUNCTION_P (t)) parms = DECL_CHAIN (parms); parms = tsubst (parms, args, complain, t); for (tree parm = parms; parm; parm = DECL_CHAIN (parm)) DECL_CONTEXT (parm) = r; - if (closure) + if (closure && !DECL_STATIC_FUNCTION_P (t)) { tree tparm = build_this_parm (r, closure, type_memfn_quals (type)); DECL_NAME (tparm) = closure_identifier; diff --git a/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C index ae022d0b971..f7ce8c03008 100644 --- a/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C +++ b/gcc/testsuite/g++.dg/cpp23/static-operator-call5.C @@ -1,5 +1,6 @@ // PR c++/108526 // { dg-do compile { target c++23 } } +// { dg-additional-options -g } PR108706 template void f() {