PR c++/71546 - lambda init-capture with qualified-id.

* parser.c (cp_parser_lambda_introducer): Clear scope after
	each lambda capture.

From-SVN: r258043
This commit is contained in:
Håkon Sandsmark 2018-02-27 20:57:35 +00:00 committed by Jason Merrill
parent 10b5c9829b
commit 76bd270a7d
3 changed files with 22 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2018-02-27 Håkon Sandsmark <hsandsmark@gmail.com>
PR c++/71546 - lambda init-capture with qualified-id.
* parser.c (cp_parser_lambda_introducer): Clear scope after
each lambda capture.
2018-02-27 Nathan Sidwell <nathan@acm.org>
PR c++/84426

View file

@ -10440,6 +10440,12 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)
capture_init_expr,
/*by_reference_p=*/capture_kind == BY_REFERENCE,
explicit_init_p);
/* If there is any qualification still in effect, clear it
now; we will be starting fresh with the next capture. */
parser->scope = NULL_TREE;
parser->qualifying_scope = NULL_TREE;
parser->object_scope = NULL_TREE;
}
cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE);

View file

@ -0,0 +1,10 @@
// PR c++/71546
// { dg-do compile { target c++14 } }
namespace n { struct make_shared { }; }
int main()
{
int x1;
[e = n::make_shared (), x1]() {};
}