From f9d94ea4d411ebc87081197daa8b53c65e50c6bd Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 20 May 1998 23:53:04 +0000 Subject: [PATCH] decl.c (grokfndecl): Handle definition of specialization in friend declaration. * decl.c (grokfndecl): Handle definition of specialization in friend declaration. * error.c (dump_decl): Fix LOOKUP_EXPR handling. From-SVN: r19919 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 27 +++++++++++++++++---------- gcc/cp/error.c | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4d991fdaab7..6353d8d31d2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +1998-05-20 Jason Merrill + + * decl.c (grokfndecl): Handle definition of specialization in + friend declaration. + + * error.c (dump_decl): Fix LOOKUP_EXPR handling. + 1998-05-20 Mark Mitchell * class.c (delete_duplicate_fields_1): Use DECL_DECLARES_TYPE_P diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 94de1dabcea..a4f9e005f55 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7625,16 +7625,23 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals, break; } - if (friendp && - TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) - { - /* A friend declaration of the form friend void f<>(). Record - the information in the TEMPLATE_ID_EXPR. */ - SET_DECL_IMPLICIT_INSTANTIATION (decl); - DECL_TEMPLATE_INFO (decl) - = perm_tree_cons (TREE_OPERAND (orig_declarator, 0), - TREE_OPERAND (orig_declarator, 1), - NULL_TREE); + if (friendp + && TREE_CODE (orig_declarator) == TEMPLATE_ID_EXPR) + { + if (funcdef_flag) + cp_error + ("defining explicit specialization `%D' in friend declaration", + orig_declarator); + else + { + /* A friend declaration of the form friend void f<>(). Record + the information in the TEMPLATE_ID_EXPR. */ + SET_DECL_IMPLICIT_INSTANTIATION (decl); + DECL_TEMPLATE_INFO (decl) + = perm_tree_cons (TREE_OPERAND (orig_declarator, 0), + TREE_OPERAND (orig_declarator, 1), + NULL_TREE); + } } /* Caller will do the rest of this. */ diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 0c72619bd0d..c7548195637 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -872,7 +872,7 @@ dump_decl (t, v) break; case LOOKUP_EXPR: - OB_PUTID (TREE_OPERAND (t, 0)); + dump_decl (TREE_OPERAND (t, 0), v); break; case LABEL_DECL: -- 2.30.2