+2003-05-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ * parser.c (cp_parser_explicit_instantiation): Restore old
+ access before template instantiation.
+
2003-05-23 Geoffrey Keating <geoffk@apple.com>
* lang-specs.h: Use -o to specify preprocessor's output file.
tree type;
type = check_tag_decl (decl_specifiers);
+ /* Turn access control back on for names used during
+ template instantiation. */
+ pop_deferring_access_checks ();
if (type)
do_type_instantiation (type, extension_specifier, /*complain=*/1);
}
/*ctor_dtor_or_conv_p=*/NULL);
decl = grokdeclarator (declarator, decl_specifiers,
NORMAL, 0, NULL);
+ /* Turn access control back on for names used during
+ template instantiation. */
+ pop_deferring_access_checks ();
/* Do the explicit instantiation. */
do_decl_instantiation (decl, extension_specifier);
}
/* We're done with the instantiation. */
end_explicit_instantiation ();
- /* Turn access control back on. */
- pop_deferring_access_checks ();
cp_parser_consume_semicolon_at_end_of_statement (parser);
}
2003-05-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+ * g++.dg/template/access11.C: New test.
+
+2003-05-25 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
PR c++/10849
* g++.dg/template/access10.C: New test.
--- /dev/null
+// Copyright (C) 2003 Free Software Foundation
+// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+// { dg-do compile }
+
+// Access checking during explicit instantiation.
+
+class A {
+ typedef int X; // { dg-error "private" }
+};
+
+class X {
+ private:
+ template <typename T> struct Y;
+};
+
+template <> struct X::Y<int> {
+ A::X x; // { dg-error "this context" }
+};
+
+template <typename T> struct X::Y {
+ typename T::X x; // { dg-error "this context" }
+};
+
+template struct X::Y<A>; // { dg-error "instantiated" }