summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-27 12:19:13 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-27 12:19:13 +0000
commit7b827e01c7469f8ac8d1b6cddc94196bcbd07894 (patch)
tree3913c3851b9b6eea4f5dc5186d9881c464352bc5 /gcc/cp/pt.c
parentd4cec55e39242cdf7c7c16a1064416e6a1bc92f9 (diff)
downloadgcc-7b827e01c7469f8ac8d1b6cddc94196bcbd07894.tar.gz
cp:
PR c++/10158 * parser.c (cp_parser_function_definition): Set DECL_INITIALIZED_IN_CLASS for members. * pt.c (instantiate_decl): Only reduce the template args for friends that are not defined in class. testsuite: PR c++/10158 * g++.dg/template/friend18.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64920 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index ab529701b5f..c04c602d867 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -10804,12 +10804,14 @@ instantiate_decl (d, defer_ok)
td = template_for_substitution (d);
code_pattern = DECL_TEMPLATE_RESULT (td);
- /* In the case of a friend template whose definition is provided
- outside the class, we may have too many arguments. Drop the ones
- we don't need. */
- args = get_innermost_template_args (gen_args,
- TMPL_PARMS_DEPTH
- (DECL_TEMPLATE_PARMS (td)));
+ if (DECL_NAMESPACE_SCOPE_P (d) && !DECL_INITIALIZED_IN_CLASS_P (d))
+ /* In the case of a friend template whose definition is provided
+ outside the class, we may have too many arguments. Drop the
+ ones we don't need. */
+ args = get_innermost_template_args
+ (gen_args, TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (td)));
+ else
+ args = gen_args;
if (TREE_CODE (d) == FUNCTION_DECL)
pattern_defined = (DECL_SAVED_TREE (code_pattern) != NULL_TREE);