From 733195e367d84914cf9a35c5c78901c973f4159a Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Tue, 5 May 2020 07:47:13 -0700 Subject: [PATCH] c++: Avoid inconsistency in lambda fn's this pointer name [pr94807] * coroutines.cc (morph_fn_to_coro): Just check for closure_identifier. * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name. --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/coroutines.cc | 5 ++--- gcc/cp/pt.c | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ef82d93bc07..3dece835650 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2020-05-05 Nathan Sidwell + + PR c++/94807 + * coroutines.cc (morph_fn_to_coro): Just check for + closure_identifier. + * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name. + 2020-05-05 Marek Polacek Jason Merrill diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index bc08b1de0ac..0c91abc84f2 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -3736,9 +3736,8 @@ morph_fn_to_coro (tree orig, tree *resumer, tree *destroyer) closure object is named 'this' instead of '__closure'. */ if (lambda_p) { - parm.lambda_cobj = parm.this_ptr - || (DECL_NAME (arg) == closure_identifier); - parm.this_ptr = false; + parm.lambda_cobj = DECL_NAME (arg) == closure_identifier; + gcc_checking_assert (!parm.this_ptr); } else parm.lambda_cobj = false; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 61cb75bf801..ff8391c2093 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13821,6 +13821,7 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain, if (closure) { tree tparm = build_this_parm (r, closure, type_memfn_quals (type)); + DECL_NAME (tparm) = closure_identifier; DECL_CHAIN (tparm) = parms; parms = tparm; } -- 2.30.2