[C++ PATCH for 4.0] Fix PR18681 (access checking for typedef types) Part 1 or 2

Kriang Lerdsuwanakij lerdsuwa@users.sourceforge.net
Wed Dec 15 15:12:00 GMT 2004


Mark Mitchell wrote:

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

Yes, I have this idea of a list of qualified-id we need to check access
planned for PR16617.  That list would be a new field in lang_specific
of RECORD_TYPE (class template), FUNCTION_DECL (function template or
member function of class template), VAR_DECL, etc.  It will contain
non-dependent TYPENAME_TYPE, UNBOUND_CLASS_TEMPLATE, and many of SCOPE_REF
nodes.

>
>
> 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.
>
We can have the same list for TYPE_DECL for the typedef but also
containing dependent qualified-id.  So for code like:

  typedef D<T::X, XX> DD;

T::X is in the list but XX isn't.  But I prefer to have some way to
mark T::X and XX differently though.

--Kriang




More information about the Gcc-patches mailing list