[cfe-dev] Templates (again)
Douglas Gregor
dgregor at apple.com
Fri Dec 26 06:58:20 PST 2008
On Dec 24, 2008, at 8:16 AM, Andrew Sutton wrote:
> The Depth/Position stuff is working toward a fix in the type system.
> Basically, template parameters in the type system will be identified
> by their kind, depth (= the number of enclosing template parameter
> lists), and position with in that template parameter list. For
> example, 'T' in
>
>
> template<typename T> void foo(T);
>
> is a template type parameter with depth=0 and position=0. That's the
> canonical type for 'T', and we'll use some sugar to give it the name
> 'T'. That way, we can quickly match the declaration above with the
> definition below
>
> template<class U> void foo(U) { }
>
> This corresponds to the GCC errors with phrases like "template
> parameter-1-1", right?
Yes, we're using the same encoding that GCC does, and the "names" of
the canonical types for template parameters will end up being
something like "type param 1-1" or "non-type param 0-1". Of course,
we'll use a sugared type to keep the appropriate names around in each
of the templates.
- Doug
More information about the cfe-dev
mailing list