Fix PR c++/70218 (illegal access to private field succeeds)
gcc/cp/ChangeLog: PR c++/70218 * parser.c (cp_parser_lambda_expression): Move call to pop_deferring_access_checks ahead of the call to cp_parser_end_tentative_firewall. gcc/testsuite/ChangeLog: PR c++/70218 * g++.dg/cpp0x/lambda/lambda-70218.C: New test. From-SVN: r234316
This commit is contained in:
parent
4a8e35b32c
commit
753a8910a4
@ -1,3 +1,10 @@
|
||||
2016-03-18 Patrick Palka <ppalka@gcc.gnu.org>
|
||||
|
||||
PR c++/70218
|
||||
* parser.c (cp_parser_lambda_expression): Move call to
|
||||
pop_deferring_access_checks ahead of the call to
|
||||
cp_parser_end_tentative_firewall.
|
||||
|
||||
2016-03-17 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/70144
|
||||
|
@ -9781,8 +9781,6 @@ cp_parser_lambda_expression (cp_parser* parser)
|
||||
= auto_is_implicit_function_template_parm_p;
|
||||
}
|
||||
|
||||
pop_deferring_access_checks ();
|
||||
|
||||
/* This field is only used during parsing of the lambda. */
|
||||
LAMBDA_EXPR_THIS_CAPTURE (lambda_expr) = NULL_TREE;
|
||||
|
||||
@ -9798,6 +9796,8 @@ cp_parser_lambda_expression (cp_parser* parser)
|
||||
|
||||
cp_parser_end_tentative_firewall (parser, start, lambda_expr);
|
||||
|
||||
pop_deferring_access_checks ();
|
||||
|
||||
return lambda_expr;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-03-18 Patrick Palka <ppalka@gcc.gnu.org>
|
||||
|
||||
PR c++/70218
|
||||
* g++.dg/cpp0x/lambda/lambda-70218.C: New test.
|
||||
|
||||
2016-03-17 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c/69407
|
||||
|
17
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-70218.C
Normal file
17
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-70218.C
Normal file
@ -0,0 +1,17 @@
|
||||
// PR c++/70218
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
struct X {
|
||||
private:
|
||||
int i;
|
||||
};
|
||||
|
||||
struct Y {
|
||||
Y (int) { }
|
||||
};
|
||||
|
||||
void
|
||||
foo ()
|
||||
{
|
||||
Y ([] { X x; x.i = 3; return 0; } ()); // { dg-error "private" }
|
||||
}
|
Loading…
Reference in New Issue
Block a user