diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-05-05 07:47:13 -0700 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-05-05 07:48:35 -0700 |
commit | 733195e367d84914cf9a35c5c78901c973f4159a (patch) | |
tree | 2c2b615bc3ce2ffbf6629897dd74a10dba105b61 /gcc | |
parent | d44f14ccef831d90feb57fab56bc3389d543ffdd (diff) | |
download | gcc-733195e367d84914cf9a35c5c78901c973f4159a.zip gcc-733195e367d84914cf9a35c5c78901c973f4159a.tar.gz gcc-733195e367d84914cf9a35c5c78901c973f4159a.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/coroutines.cc | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 1 |
3 files changed, 10 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ef82d93..3dece83 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2020-05-05 Nathan Sidwell <nathan@acm.org> + + 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 <polacek@redhat.com> Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index bc08b1d..0c91abc 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 61cb75b..ff8391c 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; } |