diff options
author | Jason Merrill <jason@redhat.com> | 2013-03-16 22:39:22 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-03-16 22:39:22 -0400 |
commit | cae7d26460f523a98305e054c3eb3d1e5726654b (patch) | |
tree | 0811ef060cab7473da032d514ae8a35637fc8e83 | |
parent | 7805032d9a298af97f9b84d62e454476b47adb79 (diff) | |
download | gcc-cae7d26460f523a98305e054c3eb3d1e5726654b.zip gcc-cae7d26460f523a98305e054c3eb3d1e5726654b.tar.gz gcc-cae7d26460f523a98305e054c3eb3d1e5726654b.tar.bz2 |
re PR c++/45917 (inaccessible types allowed as template argument in nested-name-specifier)
PR c++/45917
* parser.c (cp_parser_template_id): Don't forget access checks.
From-SVN: r196744
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/access26.C | 6 |
3 files changed, 10 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 171c52a..5e42ff5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2013-03-16 Jason Merrill <jason@redhat.com> + PR c++/45917 + * parser.c (cp_parser_template_id): Don't forget access checks. + PR c++/52374 * pt.c (tsubst_qualified_id): Use current_nonlambda_class_type. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 66684dc..47ff995 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12818,7 +12818,7 @@ cp_parser_template_id (cp_parser *parser, error_at (token->location, "parse error in template argument list"); } - pop_deferring_access_checks (); + pop_to_parent_deferring_access_checks (); return template_id; } diff --git a/gcc/testsuite/g++.dg/template/access26.C b/gcc/testsuite/g++.dg/template/access26.C new file mode 100644 index 0000000..1c5de9a --- /dev/null +++ b/gcc/testsuite/g++.dg/template/access26.C @@ -0,0 +1,6 @@ +// PR c++/45917 + +template < typename T > +struct A { static int i; }; +class B { typedef int X; }; // { dg-error "private" } +void f() { A<B::X>::i = 0; } // { dg-error "this context" } |