summaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-10-20 18:46:24 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>1997-10-20 18:46:24 +0000
commit637be7c848565adacf7fa5650805980d45f1a08c (patch)
tree2bd335677e64a3452d29460d3979433fbd3f015d /gcc/cp
parentc4d89d79c7a57afe3e1dc824e4eaf2eecee5120a (diff)
downloadgcc-637be7c848565adacf7fa5650805980d45f1a08c.tar.gz
Mon Oct 20 11:44:20 1997 Mark Mitchell <mmitchell@usa.net>
* decl.c (duplicate_decls): Handle template specializations correctly. * error.c (dump_function_name): Fix printing of specializations of member functions that are not member templates. * cp-tree.h (processing_specialization): Make global. * pt.c (processing_specialization): Likewise. * lex.c (cons_up_default_function): Save and restore processing_specialization to avoid confusion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16101 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h1
-rw-r--r--gcc/cp/decl.c3
-rw-r--r--gcc/cp/error.c3
-rw-r--r--gcc/cp/lex.c8
-rw-r--r--gcc/cp/pt.c2
7 files changed, 26 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c30348906ef..56722890d11 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+Mon Oct 20 11:44:20 1997 Mark Mitchell <mmitchell@usa.net>
+
+ * decl.c (duplicate_decls): Handle template specializations
+ correctly.
+ * error.c (dump_function_name): Fix printing of specializations of
+ member functions that are not member templates.
+ * cp-tree.h (processing_specialization): Make global.
+ * pt.c (processing_specialization): Likewise.
+ * lex.c (cons_up_default_function): Save and restore
+ processing_specialization to avoid confusion.
+
Mon Oct 20 10:52:22 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (init_decl_processing): Give null_node unknown* type.
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index e24d6a230b9..aac95b815d1 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2093,7 +2093,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
tree f;
tree spec_args;
- /* If there is a template, and t uses template parms, wer
+ /* If there is a template, and t uses template parms, we
are dealing with a specialization of a member
template in a template class, and we must grab the
template, rather than the function. */
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 3cb83df2580..06a8c647103 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -2352,6 +2352,7 @@ extern tree most_specialized_class PROTO((tree, tree));
extern int more_specialized_class PROTO((tree, tree));
extern void do_pushlevel PROTO((void));
extern int is_member_template PROTO((tree));
+extern int processing_specialization;
/* in repo.c */
extern void repo_template_used PROTO((tree));
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 59fdbb32757..ca21b486f8d 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2866,6 +2866,9 @@ duplicate_decls (newdecl, olddecl)
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
+ if (DECL_TEMPLATE_INSTANTIATION (olddecl) &&
+ !DECL_TEMPLATE_INSTANTIATION (newdecl))
+ DECL_USE_TEMPLATE (olddecl) = DECL_USE_TEMPLATE (newdecl);
DECL_THIS_INLINE (newdecl) |= DECL_THIS_INLINE (olddecl);
/* If either decl says `inline', this fn is inline, unless its
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 5128175233f..5cac56510d6 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -925,7 +925,8 @@ dump_function_name (t)
else
dump_decl (name, 0);
- if (DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t))
+ if ((DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t))
+ && (DECL_CLASS_CONTEXT (t) == NULL_TREE || is_member_template (t)))
{
tree args = DECL_TEMPLATE_INFO (t)
? DECL_TI_ARGS (t) : NULL_TREE;
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 9a795353f7d..863fe4cbdcd 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -1988,10 +1988,16 @@ cons_up_default_function (type, full_name, kind)
{
tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE);
+ int saved_processing_specialization;
if (retref)
declarator = build_parse_node (ADDR_EXPR, declarator);
-
+
+ /* The following is in case we're generating the default
+ implementation in the midst of handling a specialization. */
+ saved_processing_specialization = processing_specialization;
+ processing_specialization = 0;
fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
+ processing_specialization = saved_processing_specialization;
}
if (fn == void_type_node)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index df453fc7856..304d48942e9 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -60,7 +60,7 @@ static tree *maybe_template_tail = &maybe_templates;
int minimal_parse_mode;
-static int processing_specialization;
+int processing_specialization;
static int template_header_count;
#define obstack_chunk_alloc xmalloc