mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-15 18:01:31 +08:00
re PR c++/3663 (G++ doesn't check access control during template instanation)
PR c++/3663 * pt.c (lookup_template_class): Copy TREE_PRIVATE and TREE_PROTECTED to created decl nodes. * g++.dg/template/access7.C: New test. From-SVN: r60307
This commit is contained in:
parent
7f60195472
commit
cab7a9a3b9
@ -1,3 +1,9 @@
|
||||
2002-12-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/3663
|
||||
* pt.c (lookup_template_class): Copy TREE_PRIVATE and
|
||||
TREE_PROTECTED to created decl nodes.
|
||||
|
||||
2002-12-18 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* class.c (build_base_field): Do not set DECL_PACKED on the
|
||||
|
@ -4235,6 +4235,11 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
|
||||
else
|
||||
type_decl = TYPE_NAME (t);
|
||||
|
||||
TREE_PRIVATE (type_decl)
|
||||
= TREE_PRIVATE (TYPE_STUB_DECL (template_type));
|
||||
TREE_PROTECTED (type_decl)
|
||||
= TREE_PROTECTED (TYPE_STUB_DECL (template_type));
|
||||
|
||||
/* Set up the template information. We have to figure out which
|
||||
template is the immediate parent if this is a full
|
||||
instantiation. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-11-18 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
|
||||
|
||||
PR c++/3663
|
||||
* g++.dg/template/access7.C: New test.
|
||||
|
||||
2002-12-18 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
* lib/g++.exp (g++_include_flags): Only invoke testsuite_flags if
|
||||
|
18
gcc/testsuite/g++.dg/template/access7.C
Normal file
18
gcc/testsuite/g++.dg/template/access7.C
Normal file
@ -0,0 +1,18 @@
|
||||
// { dg-do compile }
|
||||
|
||||
// PR c++/3663
|
||||
// Enforce access of nested type.
|
||||
|
||||
template <typename A>
|
||||
class S {
|
||||
class T {}; // { dg-error "private" }
|
||||
};
|
||||
|
||||
template <typename A>
|
||||
typename A::T* f (A) { // { dg-error "this context" }
|
||||
return 0;
|
||||
}
|
||||
|
||||
void g () {
|
||||
f (S<int> ()); // { dg-error "context|instantiated" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user