aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@gcc.gnu.org>2018-12-14 20:06:15 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2018-12-14 20:06:15 +0000
commitb96778342fa7d6890876eecdaa0470b3915724e6 (patch)
tree62705ec239a3cab52c9b845c189440d116f5119c /gcc/cp
parent0fca07e31dc85bea3b1d669d7cc1d51d22192335 (diff)
downloadgcc-b96778342fa7d6890876eecdaa0470b3915724e6.zip
gcc-b96778342fa7d6890876eecdaa0470b3915724e6.tar.gz
gcc-b96778342fa7d6890876eecdaa0470b3915724e6.tar.bz2
[PR86823] retain deferred access checks from outside firewall
We used to preserve deferred access check along with resolved template ids, but a tentative parsing firewall introduced additional layers of deferred access checks, so that we don't preserve the checks we want to any more. This patch moves the deferred access checks from outside the firewall into it. From: Jason Merrill <jason@redhat.com> for gcc/cp/ChangeLog PR c++/86823 * parser.c (cp_parser_template_id): Rearrange deferred access checks into the firewall. From: Alexandre Oliva <aoliva@redhat.com> for gcc/testsuite/ChangeLog PR c++/86823 * g++.dg/pr86823.C: New. From-SVN: r267144
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c10
2 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6460a66..0467ca2 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-14 Jason Merrill <jason@redhat.com>
+
+ PR c++/86823
+ * parser.c (cp_parser_template_id): Rearrange deferred access
+ checks into the firewall.
+
2018-12-14 Jakub Jelinek <jakub@redhat.com>
PR c++/82294
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 7ff113f..b57e35d 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -16187,16 +16187,18 @@ cp_parser_template_id (cp_parser *parser,
is_declaration,
tag_type,
&is_identifier);
+
+ /* Push any access checks inside the firewall we're about to create. */
+ vec<deferred_access_check, va_gc> *checks = get_deferred_access_checks ();
+ pop_deferring_access_checks ();
if (templ == error_mark_node || is_identifier)
- {
- pop_deferring_access_checks ();
- return templ;
- }
+ return templ;
/* Since we're going to preserve any side-effects from this parse, set up a
firewall to protect our callers from cp_parser_commit_to_tentative_parse
in the template arguments. */
tentative_firewall firewall (parser);
+ reopen_deferring_access_checks (checks);
/* If we find the sequence `[:' after a template-name, it's probably
a digraph-typo for `< ::'. Substitute the tokens and check if we can