This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/9990: locale_facets.h contains invalid typedef
- From: Nathan Sidwell <nathan dot sidwell at blueyonder dot co dot uk>
- To: paolo at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nasgaard at ca dot ibm dot com, nathan at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Sun, 09 Mar 2003 15:53:28 +0000
- Subject: Re: c++/9990: locale_facets.h contains invalid typedef
- References: <20030309115440.21241.qmail@sources.redhat.com>
I can't tell if this is well formed or not.
typename ctype::mask is looked up at instantiation time. Now does it find the
typedef in ctype, or does it find the typedef in ctype_base? If this were
not a template class, it would find the latter, ctype::mask not being in scope
at the point of parsing the decl-spec.
I believe class template instantiation should behave as closely as possible
to the non-template equivalent. In which case the typename will find
the name in the base class, and then insert the typedef into the instantiated
class's scope. The standard doesn't specify precisely how instantiation
happens. There are (sort of) two choices
1) build up the instantiated class and its members much like a non-template
class definition is constructed. I.e. what I've described above
2) bind all the names declared, to types, functions, fields or whatever,
then instantiate each of those declared things.
IIRC gcc kind of does a mixture of the two :(
Anyway, even if we do 1, do we fall foul of [3.3.6]/2? I think we do.
note no diagnostic is required for such a violation. We also fail to issue one
for the non-template case of N being a qualified id. Such as,
struct B { typedef int X;};
struct C : B { typedef C::X Y;
int X;
};
I think this is really a 'request for change'
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
The voices in my head said this was stupid too
nathan at codesourcery dot com : http://www.cs.bris.ac.uk/~nathan/ : nathan at acm dot org