This is the mail archive of the 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:
Nathan Sidwell wrote:

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.)


I discover some flaw in my patch and the approach used has to be revised. The flaw is that the typedef access checking is either turned on or off entirely. So it doesn't work for case like:

typedef D<T::X, XX> DD; // XX is declared by an earlier typedef

where we want to check T::X but not XX, all within the same typedef.
I am thinking some solutions and could wait for your work before continue
working on it.  The posted patches for PR18681 is retracted.

I think this is one of those issues we should just leave alone until we are ready to fix it correctly.

Unfortunately, C++ requires both that (a) we resolve qualification in templates when parsing things that are non-dependent, and (b) that we preserve the qualification until instantiation time to check access. I think that the only solution to this is, ultimately, to keep a list of (dependent) things that must be checked at instantiation time, even after resolving dependencies.

At present, I've taken the approach that we resolve the dependent names, as required for correctness of valid code, and that if we miss some access checking, oh, well, that only affects invalid code. However, it seems like you've found a case where that approach isn't working.

Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

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