aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 2ecb17c..62812a5 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -628,7 +628,14 @@ lambda_expr_this_capture (tree lambda)
/* In unevaluated context this isn't an odr-use, so just return the
nearest 'this'. */
if (cp_unevaluated_operand)
- return lookup_name (this_identifier);
+ {
+ /* In an NSDMI the fake 'this' pointer that we're using for
+ parsing is in scope_chain. */
+ if (LAMBDA_EXPR_EXTRA_SCOPE (lambda)
+ && TREE_CODE (LAMBDA_EXPR_EXTRA_SCOPE (lambda)) == FIELD_DECL)
+ return scope_chain->x_current_class_ptr;
+ return lookup_name (this_identifier);
+ }
/* Try to default capture 'this' if we can. */
if (!this_capture