Template template parameter patch

Kriang Lerdsuwanakij lerdsuwa@scf-fs.usc.edu
Fri Jan 16 01:51:00 GMT 1998


[This is my 3rd attempt to post this mail.  Sorry if you receive
duplicate post.]

Hi,

I finished an implementation of template template parameter for egcs. 
The patch and ChangeLog is in the file
	egcs-971225-ttp980113.patch
at
	http://www-scf.usc.edu/~lerdsuwa/util/patch/

The patch is against egcs-971225.  It passes the regression test.  Only
2 new test cases (ttp22.C and ttp23.C) fails.  I will post a fix to
these 2 cases as a separate patch since it has nothing to do with
template template parameter - template name D being introduced in
derived class scope as D<int>.

Implementataion details:

The design involves a new TEMPLATE_TEMPLATE_PARM node.  It is similar to
TEMPLATE_TYPE_PARM except that its TYPE_NAME is a TEMPLATE_DECL and its
template arguments, if present, are kept inside the
CLASSTYPE_TEMPLATE_INFO field.

In template argument substitution, a TEMPLATE_TEMPLATE_PARM with
template arguments (which appears as a type like TT<int> where TT is a
template parameter) is turned into a RECORD_TYPE while the one without
template arguments (one that is part of template signature like  int
f<TT>() ) is turned into a TEMPLATE_DECL.

The character 'z' is used in name mangling.
If the template template parameter is used in a type, it is encoded as
zX?? (?? = template argument level and index).
If used as template argument in signature, the argument is encoded as
	z + <number of parameter> + <parameter list>
	  + <length of substituted template name>
	  + <subst. template name>

Enjoy!

Kriang



More information about the Gcc mailing list