diff options
author | Kriang Lerdsuwanakij <lerdsuwa@scf.usc.edu> | 2000-06-23 06:49:45 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2000-06-23 02:49:45 -0400 |
commit | 1899c3a49ed1f0516e56c41070951c9e0e4d9e4f (patch) | |
tree | 1031c3579a6b908c1508fb505a7aab1f459c9611 /gcc/cp/tree.c | |
parent | 691125710d580d96e6c94f04fe0e1205507ee899 (diff) | |
download | gcc-1899c3a49ed1f0516e56c41070951c9e0e4d9e4f.zip gcc-1899c3a49ed1f0516e56c41070951c9e0e4d9e4f.tar.gz gcc-1899c3a49ed1f0516e56c41070951c9e0e4d9e4f.tar.bz2 |
parse.y (template_arg): Convert TEMPLATE_DECL that is a template template paramter to...
* parse.y (template_arg): Convert TEMPLATE_DECL
that is a template template paramter to
TEMPLATE_TEMPLATE_PARM here.
* cp-tree.def (TEMPLATE_TEMPLATE_PARM): Adjust comment.
* cp-tree.h (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): New macro.
(copy_template_template_parm): Adjust prototype.
* decl.c (grokdeclarator): Remove dead code.
* pt.c (process_template_parm): Tidy.
(lookup_template_class): Construct nodes in
copy_template_template_parm.
(tsubst): Pass TEMPLATE_DECL rather than IDENTIFIER_NODE to
lookup_template_class. Use TYPE_TI_TEMPLATE.
* tree.c (copy_template_template_parm): Add NEWARGS
parameter.
(mapcar): Adjust call to copy_template_template_parm.
* typeck.c (comptypes): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL.
* method.c (build_template_template_parm_names): Change error
code to avoid compilation warning.
* gxxint.texi: Document template template parameter
name mangling.
From-SVN: r34659
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r-- | gcc/cp/tree.c | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index cdf0c13..f055899 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1173,26 +1173,45 @@ build_exception_variant (type, raises) } /* Given a TEMPLATE_TEMPLATE_PARM node T, create a new one together with its - lang_specific field and its corresponding TEMPLATE_DECL node */ + lang_specific field and its corresponding *_DECL node. + If NEWARGS is not NULL_TREE, this parameter is bound with new set of + arguments. */ tree -copy_template_template_parm (t) +copy_template_template_parm (t, newargs) tree t; + tree newargs; { - tree template = TYPE_NAME (t); + tree decl = TYPE_NAME (t); tree t2; t2 = make_aggr_type (TEMPLATE_TEMPLATE_PARM); - template = copy_decl (template); + if (newargs == NULL_TREE) + { + decl = copy_decl (decl); + + /* No need to copy these. */ + TEMPLATE_TYPE_PARM_INDEX (t2) = TEMPLATE_TYPE_PARM_INDEX (t); + TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2) + = TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t); + } + else + { + decl = build_decl (TYPE_DECL, DECL_NAME (decl), NULL_TREE); + + /* These nodes have to be created to reflect new TYPE_DECL and template + arguments. */ + TEMPLATE_TYPE_PARM_INDEX (t2) = copy_node (TEMPLATE_TYPE_PARM_INDEX (t)); + TEMPLATE_PARM_DECL (TEMPLATE_TYPE_PARM_INDEX (t2)) = decl; + TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2) + = tree_cons (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (t), + newargs, NULL_TREE); + } - TREE_TYPE (template) = t2; - TYPE_NAME (t2) = template; - TYPE_STUB_DECL (t2) = template; + TREE_TYPE (decl) = t2; + TYPE_NAME (t2) = decl; + TYPE_STUB_DECL (t2) = decl; - /* No need to copy these */ - TYPE_FIELDS (t2) = TYPE_FIELDS (t); - TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t2) - = TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO (t); return t2; } @@ -1496,7 +1515,7 @@ copy_tree_r (tp, walk_subtrees, data) } else if (code == TEMPLATE_TEMPLATE_PARM) /* These must be copied specially. */ - *tp = copy_template_template_parm (*tp); + *tp = copy_template_template_parm (*tp, NULL_TREE); else if (TREE_CODE_CLASS (code) == 't') /* There's no need to copy types, or anything beneath them. */ *walk_subtrees = 0; |