[C++ PATCH] Fix PR4802, 5387
Gabriel Dos Reis
gdr@codesourcery.com
Sun May 26 10:44:00 GMT 2002
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
More information about the Gcc-patches
mailing list