This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix PR4802, 5387


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]