This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix PR4802, 5387
- From: Gabriel Dos Reis <gdr at codesourcery dot com>
- To: lerdsuwa at users dot sourceforge dot net
- Cc: gcc-patches at gcc dot gnu dot org
- Date: 26 May 2002 19:18:37 +0200
- Subject: Re: [C++ PATCH] Fix PR4802, 5387
- Organization: CodeSourcery, LLC
- References: <3CF114B9.81350BB9@users.sourceforge.net>
Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> writes:
[...]
| + // PR c++/5387
| + // Enforcing access of typename type.
| +
| + template <class T> struct A {
| + typename T::X x; // { dg-error "this context" }
| + int f() { return T::i; } // { dg-error "this context" }
| + };
That is not an error when A<> is explicitly instantiated:
17.4.2/8
The usual access checking rules do not apply to names used to
specify explicit instantiations. [Note: In par-ticular, the template
arguments and names used in the function declarator (including
parameter types, return types and exception specifications) may be
private types or objects which would normally not be accessible and
the template may be a member template or member function which would
not normally be accessible. ]
-- Gaby