c++: Avoid inconsistency in lambda fn's this pointer name [pr94807]
authorNathan Sidwell <nathan@acm.org>
Tue, 5 May 2020 14:47:13 +0000 (07:47 -0700)
committerNathan Sidwell <nathan@acm.org>
Tue, 5 May 2020 14:48:35 +0000 (07:48 -0700)
* 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
gcc/cp/coroutines.cc
gcc/cp/pt.c

index ef82d93bc071d28c3df015f9e0bce915cfdf6d5d..3dece835650e8a4aabf1f61c74cad4299e0395f3 100644 (file)
@@ -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>
 
index bc08b1de0acbfabca941e1213ab552477d4925f0..0c91abc84f26f4614f5b471fa7db281d2da56c12 100644 (file)
@@ -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;
index 61cb75bf801e07875e28fe0ebc5140353a15deed..ff8391c2093aaf0733d5181205dbd2fbdaa1b7e9 100644 (file)
@@ -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;
     }