aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2013-10-17 16:58:45 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2013-10-17 16:58:45 +0000
commit206b48e4e7fcc47d9877fe5aaae9eaecde21b3bf (patch)
treef53ed8e96db4c070a9d795f2b68c14be414fba19 /gcc/cp/lambda.c
parentf541a48127a1940dce8dc8f48d88ccb04aa2a31e (diff)
downloadgcc-206b48e4e7fcc47d9877fe5aaae9eaecde21b3bf.zip
gcc-206b48e4e7fcc47d9877fe5aaae9eaecde21b3bf.tar.gz
gcc-206b48e4e7fcc47d9877fe5aaae9eaecde21b3bf.tar.bz2
re PR c++/58596 ([c++11] ICE with decltype in non-static data member initializer)
/cp 2013-10-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58596 * lambda.c (lambda_expr_this_capture): Handle NSDMIs in the cp_unevaluated_operand case. /testsuite 2013-10-17 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58596 * g++.dg/cpp0x/lambda/lambda-nsdmi5.C: New From-SVN: r203780
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