diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-06 21:36:28 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-03-07 14:34:10 -0500 |
commit | 4f181f9c7ee3efc509d185fdfda33be9018f1611 (patch) | |
tree | 2cf9f6fe3d9b7ca4c707d21d93597c8b930a97b9 /gcc | |
parent | f875857e008c4415c32d2f15e88f04c3e42719ea (diff) | |
download | gcc-4f181f9c7ee3efc509d185fdfda33be9018f1611.zip gcc-4f181f9c7ee3efc509d185fdfda33be9018f1611.tar.gz gcc-4f181f9c7ee3efc509d185fdfda33be9018f1611.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/pt.cc | 4 | ||||
-rw-r--r-- | 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 85136df..aafc99d 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 ae022d0..f7ce8c0 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<class> void f() { |