diff options
author | Mark Mitchell <mark@codesourcery.com> | 2005-10-20 18:01:52 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 2005-10-20 18:01:52 +0000 |
commit | 94c813b4572f371dcdb8aca1ed4bf0d37cde47a6 (patch) | |
tree | d95106204bf6a622797c7dce4267d7c630cfe311 /gcc/cp | |
parent | 9ca4afb947aa1edc2da5d4d8f809f92eb5b7149c (diff) | |
download | gcc-94c813b4572f371dcdb8aca1ed4bf0d37cde47a6.zip gcc-94c813b4572f371dcdb8aca1ed4bf0d37cde47a6.tar.gz gcc-94c813b4572f371dcdb8aca1ed4bf0d37cde47a6.tar.bz2 |
re PR c++/22618 (Template non-type arguments break class access protection)
PR c++/22618
* search.c (accessible_p): Check access in the outermost set of
template parameters.
PR c++/22618
* g++.dg/parse/access8.C: New test.
From-SVN: r105682
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/search.c | 8 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2344732..bba2e8e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-20 Mark Mitchell <mark@codesourcery.com> + + PR c++/22618 + * search.c (accessible_p): Check access in the outermost set of + template parameters. + 2005-10-20 Richard Guenther <rguenther@suse.de> * decl.c (grokdeclarator): Fix ambiguous pedwarn message. diff --git a/gcc/cp/search.c b/gcc/cp/search.c index 795e8c2..090510b 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -872,8 +872,12 @@ accessible_p (tree type, tree decl, bool consider_local_p) /* In a template declaration, we cannot be sure whether the particular specialization that is instantiated will be a friend or not. Therefore, all access checks are deferred until - instantiation. */ - if (processing_template_decl) + instantiation. However, PROCESSING_TEMPLATE_DECL is set in the + parameter list for a template (because we may see dependent types + in default arguments for template parameters), and access + checking should be performed in the outermost parameter list. */ + if (processing_template_decl + && (!processing_template_parmlist || processing_template_decl > 1)) return 1; if (!TYPE_P (type)) |