return NULL_TREE;
}
+ if ((TREE_CODE (stmt) == VAR_DECL
+ || TREE_CODE (stmt) == PARM_DECL
+ || TREE_CODE (stmt) == RESULT_DECL)
+ && DECL_HAS_VALUE_EXPR_P (stmt)
+ /* Walk DECL_VALUE_EXPR mainly for benefit of xobj lambdas so that we
+ adjust any invisiref object parm uses within the capture proxies.
+ TODO: For GCC 17 do this walking unconditionally. */
+ && current_function_decl
+ && DECL_XOBJ_MEMBER_FUNCTION_P (current_function_decl)
+ && LAMBDA_FUNCTION_P (current_function_decl))
+ {
+ tree ve = DECL_VALUE_EXPR (stmt);
+ cp_walk_tree (&ve, cp_genericize_r, data, NULL);
+ SET_DECL_VALUE_EXPR (stmt, ve);
+ }
+
switch (TREE_CODE (stmt))
{
case ADDR_EXPR:
--- /dev/null
+// PR c++/121500
+// { dg-do run { target c++23 } }
+
+struct A {
+ A() = default;
+ A(const A& other) : n(other.n) { }
+ int n = 42;
+};
+
+int main() {
+ A a;
+ auto l = [a](this auto self) {
+ return a.n == 42;
+ };
+ if (!l())
+ __builtin_abort();
+}