On 11/15/07, Rob Quill <[EMAIL PROTECTED]> wrote: > Hi, > > I was wondering if anyone could help me make sense of the > more_specialized_fn() function in pt.c (line 13281). > > Specifically, I am trying to understand what each of the are: > > tree decl1 = DECL_TEMPLATE_RESULT (pat1);
This is the actual FUNCTION_DECL node that represents the function template. It's just like another other (non-template) FUNCTION_DECL, except that it's associated with a template and will use some of the template parameters in its definition and declaration. > tree targs1 = make_tree_vec (DECL_NTPARMS (pat1)); DECL_NTPARMS is the number of template parameters, so we're just making a vector that long. > tree tparms1 = DECL_INNERMOST_TEMPLATE_PARMS (pat1); For member templates, this pulls out just the innermost template parameters. > tree args1 = TYPE_ARG_TYPES (TREE_TYPE (decl1)); This is the list of function parameter types. e.g., in a function template template<typename T> void f(T*, int, float); this would be a TREE_LIST containing the types T*,, int, and float. > and how the function is supposed to deal with variadic functions in > terms of these. That is to say, if a function is variadic, how is that > represented in these data structures? By "variadic" I assume you mean C-style variadic functions, e.g., template<typename T> void f(T x, ...); and not the C++0x variadic templates. The presence of an ellipsis is indicated by the last node in the TREE_LIST being void_list_node; if there is no ellipsis, the last parameter's TREE_CHAIN will simply be NULL_TREE. - Doug