+Wed Apr 1 14:58:35 1998 Mark Mitchell <mmitchell@usa.net>
+
+ * call.c (build_over_call): Do name resolution for default
+ arguments of function templates in the scope of the templates.
+
Tue Mar 31 13:43:57 1998 Jeffrey A Law (law@cygnus.com)
* call.c: Include system.h. Remove includes, declarations and
tree arg = TREE_PURPOSE (parm);
if (DECL_TEMPLATE_INFO (fn))
- /* This came from a template. Instantiate the default arg here,
- not in tsubst. */
- arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
+ {
+ /* This came from a template. Instantiate the default arg here,
+ not in tsubst. In the case of something like:
+
+ template <class T>
+ struct S {
+ static T t();
+ void f(T = t());
+ };
+
+ we must be careful to do name lookup in the scope of
+ S<T>, rather than in the current class. */
+ if (DECL_REAL_CONTEXT (fn))
+ pushclass (DECL_REAL_CONTEXT (fn), 2);
+
+ arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
+
+ if (DECL_REAL_CONTEXT (fn))
+ popclass (0);
+ }
converted_args = expr_tree_cons
(NULL_TREE, convert_default_arg (TREE_VALUE (parm), arg),
converted_args);