This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] Use num_parm_types and nth_parm_type in tsubst_default_arguments.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 28 Jun 2006 09:33:58 -0700
- Subject: [lto] Use num_parm_types and nth_parm_type in tsubst_default_arguments.
Hi,
Tested on x86_64-pc-linux-gnu. Committed to the LTO branch as
obvious.
Kazu Hirata
2006-06-28 Kazu Hirata <kazu@codesourcery.com>
* pt.c (tsubst_default_arguments): Use num_parm_types and
nth_parm_type in tsubst_default_arguments.
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 114740)
+++ cp/pt.c (working copy)
@@ -6097,6 +6097,8 @@ tsubst_default_arguments (tree fn)
tree arg;
tree type;
tree tmpl_args;
+ int len;
+ int i;
tmpl_args = DECL_TI_ARGS (fn);
@@ -6105,12 +6107,14 @@ tsubst_default_arguments (tree fn)
if (uses_template_parms (tmpl_args))
return;
- for (type = TYPE_ARG_TYPES (TREE_TYPE (fn)), arg = DECL_ARGUMENTS (fn);
- type && arg;
- type = TREE_CHAIN (type), arg = TREE_CHAIN (arg))
+ type = TYPE_ARG_TYPES (TREE_TYPE (fn));
+ len = num_parm_types (type);
+ for (i = 0, arg = DECL_ARGUMENTS (fn);
+ i < len && arg;
+ i++, arg = TREE_CHAIN (arg))
if (DECL_INITIAL (arg))
DECL_INITIAL (arg) = tsubst_default_argument (fn,
- TREE_VALUE (type),
+ nth_parm_type (type, i),
DECL_INITIAL (arg));
}