diff options
author | Håkon Sandsmark <hsandsmark@gmail.com> | 2018-02-27 20:57:35 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-02-27 15:57:35 -0500 |
commit | 76bd270a7df7dbf5a02046072947802365bb67f6 (patch) | |
tree | 865ff09090dd928caaa7a551839bd1c56d4206c0 /gcc | |
parent | 10b5c9829b7e162342e8e730b6ed072bcd0dc7b2 (diff) | |
download | gcc-76bd270a7df7dbf5a02046072947802365bb67f6.zip gcc-76bd270a7df7dbf5a02046072947802365bb67f6.tar.gz gcc-76bd270a7df7dbf5a02046072947802365bb67f6.tar.bz2 |
PR c++/71546 - lambda init-capture with qualified-id.
* parser.c (cp_parser_lambda_introducer): Clear scope after
each lambda capture.
From-SVN: r258043
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/lambda-init17.C | 10 |
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dbb678c..20c15e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index bcee121..e02d4bf 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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); diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-init17.C b/gcc/testsuite/g++.dg/cpp1y/lambda-init17.C new file mode 100644 index 0000000..6c7cb44 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-init17.C @@ -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]() {}; +} |