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 for 4.0] Fix PR18681 (access checking for typedeftypes) Part 1 or 2


Kriang Lerdsuwanakij wrote:
Hi

This patch is a partial fix to PR18681 (a regression) for GCC 4.0.
The version for 3.4 branch will be posted separately due to
lots of differences of code surrounding the changes.

The problem in PR18681 is that we don't check access correctly for
code like:

 class C {
   typedef int X;
   template <class T> friend class A;
 };

 template <classs T> class A {
   typedef typename T::X XX;
   class B {
     void f(XX);    // should be allowed, currently issue error
            // message that C::X is private
   };
 };

template class A<C>;

We have problem accessing 'XX' at the commented line despite it's a name
from the enclosing class of 'B'. This because the type of 'XX' is 'typename T::X' from typedef declaration.

it appears that in working on DR189, I'm hitting a similar problem with such typedefs and conversion operators. I am investigating an approach which might help here too. I'll let you know how it turns out, and then review this patch if needed. (I didn't know of the collision until a few minutes ago.)

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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