aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>2003-12-18 14:14:48 +0000
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>2003-12-18 14:14:48 +0000
commitbc5ada84727516c1617c604837fa9c58a4a689db (patch)
tree78873f365080098891486f2efb05027c8a8519ca /gcc/cp/pt.c
parentcebf212fa5edc019a992981e7aab39517ac93c3f (diff)
downloadgcc-bc5ada84727516c1617c604837fa9c58a4a689db.zip
gcc-bc5ada84727516c1617c604837fa9c58a4a689db.tar.gz
gcc-bc5ada84727516c1617c604837fa9c58a4a689db.tar.bz2
re PR c++/13262 ("xxx is private within this context" when initializing a *self-contained* template class)
PR c++/13262 * pt.c (instantiate_decl): Wrap push_nested_class and pop_nested_class around cp_finish_decl call for static member variable. * g++.dg/template/access13.C: New test. From-SVN: r74780
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1a03bba..8445dce 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -11115,10 +11115,20 @@ instantiate_decl (tree d, int defer_ok)
/* Mark D as instantiated so that recursive calls to
instantiate_decl do not try to instantiate it again. */
DECL_TEMPLATE_INSTANTIATED (d) = 1;
+ /* This is done in analogous to `start_decl'. It is
+ required for correct access checking. */
+ push_nested_class (DECL_CONTEXT (d));
cp_finish_decl (d,
(!DECL_INITIALIZED_IN_CLASS_P (d)
? DECL_INITIAL (d) : NULL_TREE),
NULL_TREE, 0);
+ /* Normally, pop_nested_class is called by cp_finish_decl
+ above. But when instantiate_decl is triggered during
+ instantiate_class_template processing, its DECL_CONTEXT
+ is still not completed yet, and pop_nested_class isn't
+ called. */
+ if (!COMPLETE_TYPE_P (DECL_CONTEXT (d)))
+ pop_nested_class ();
}
}
else if (TREE_CODE (d) == FUNCTION_DECL)