Compiling coroutines/pr95736.C with the implicit constexpr patch broke
because is_this_parameter didn't recognize the coroutines proxy for 'this'.

Tested x86_64-pc-linux-gnu, applying to trunk.

gcc/cp/ChangeLog:

        * semantics.c (is_this_parameter): Check DECL_HAS_VALUE_EXPR_P
        instead of is_capture_proxy.
---
 gcc/cp/semantics.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 60e0982cc48..15404426bce 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -11382,7 +11382,8 @@ is_this_parameter (tree t)
 {
   if (!DECL_P (t) || DECL_NAME (t) != this_identifier)
     return false;
-  gcc_assert (TREE_CODE (t) == PARM_DECL || is_capture_proxy (t)
+  gcc_assert (TREE_CODE (t) == PARM_DECL
+             || (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
              || (cp_binding_oracle && TREE_CODE (t) == VAR_DECL));
   return true;
 }

base-commit: bd95d75f3412e1a7debab7c6c602ba409f274eb5
-- 
2.27.0

Reply via email to