diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-22 19:22:11 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-22 19:22:11 +0000 |
commit | 2e227398d356bea895dbbf2aa4066c5df99f632b (patch) | |
tree | c400f29d211f1ef321ecdd015d159c8337af81b3 /gcc/cp/lambda.c | |
parent | f915a72515e4acffc38b4dd67517960ede3d5bcf (diff) | |
download | gcc-2e227398d356bea895dbbf2aa4066c5df99f632b.tar.gz |
PR c++/63320
PR c++/60463
PR c++/60755
* lambda.c (maybe_resolve_dummy, lambda_expr_this_capture): Handle
not finding 'this'.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215478 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r-- | gcc/cp/lambda.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 0d8d4551a0f..17fd0377eb9 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -724,7 +724,8 @@ lambda_expr_this_capture (tree lambda, bool add_capture_p) if (!this_capture) { - error ("%<this%> was not captured for this lambda function"); + if (add_capture_p) + error ("%<this%> was not captured for this lambda function"); result = error_mark_node; } else @@ -768,8 +769,9 @@ maybe_resolve_dummy (tree object, bool add_capture_p) /* In a lambda, need to go through 'this' capture. */ tree lam = CLASSTYPE_LAMBDA_EXPR (current_class_type); tree cap = lambda_expr_this_capture (lam, add_capture_p); - object = build_x_indirect_ref (EXPR_LOCATION (object), cap, - RO_NULL, tf_warning_or_error); + if (cap != error_mark_node) + object = build_x_indirect_ref (EXPR_LOCATION (object), cap, + RO_NULL, tf_warning_or_error); } return object; |