diff options
author | Mark Mitchell <mmitchell@usa.net> | 1998-04-01 16:27:24 +0000 |
---|---|---|
committer | Mark Mitchell <mmitchel@gcc.gnu.org> | 1998-04-01 16:27:24 +0000 |
commit | 59581da6977aeae5819b43ebdd1eed1ee7f0d514 (patch) | |
tree | 1827084179aea726791cfee72adc008fb5569df5 /gcc/cp/call.c | |
parent | 63959c221b111a8fd35f08b1f66831edf740c248 (diff) | |
download | gcc-59581da6977aeae5819b43ebdd1eed1ee7f0d514.zip gcc-59581da6977aeae5819b43ebdd1eed1ee7f0d514.tar.gz gcc-59581da6977aeae5819b43ebdd1eed1ee7f0d514.tar.bz2 |
call.c (build_over_call): Do name resolution for default arguments of function templates in the scope of...
* call.c (build_over_call): Do name resolution for default
arguments of function templates in the scope of the templates.
From-SVN: r18932
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 2959fc2..ab3e05e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3220,9 +3220,26 @@ build_over_call (fn, convs, args, flags) 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); |