This is the mail archive of the gcc-bugs@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++/9990: locale_facets.h contains invalid typedef


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



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