diff options
| author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-17 12:26:39 +0000 |
|---|---|---|
| committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-08-17 12:26:39 +0000 |
| commit | eccec8533b50a1076b3eb8bb85615a90b121cab3 (patch) | |
| tree | dc83201e24e209489973c8e23767f94b2ee9b3ac /gcc/cp/decl.c | |
| parent | d8b0b2aeb678bdb1192c73447c7131179ac8806a (diff) | |
| download | ppe42-gcc-eccec8533b50a1076b3eb8bb85615a90b121cab3.tar.gz ppe42-gcc-eccec8533b50a1076b3eb8bb85615a90b121cab3.zip | |
* cp-tree.h (CPTR_AGGR_TAG): New global tree node.
(current_aggr): Define.
* decl.c (grokdeclarator): Make sure a friend class is an
elaborated type specifier.
* parse.y (current_aggr): Remove static definition.
(cp_parse_init): Adjust.
(structsp): Clear and restore current_aggr.
(component_decl_list): Clear current_aggr.
* error.c (dump_type, case TYPENAME_TYPE): Don't emit the
aggregate tag on the typename's context.
* pt.c (tsubst_friend_class): Return NULL, if parms becomes NULL.
(instantiate_class_template): Ignore NULL friend types.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35755 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
| -rw-r--r-- | gcc/cp/decl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e84264df391..e41562809b5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -11220,6 +11220,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) cp_error ("`inline' specified for friend class declaration"); inlinep = 0; } + if (!current_aggr && TREE_CODE (type) != TYPENAME_TYPE) + { + if (TREE_CODE (type) == TEMPLATE_TYPE_PARM) + cp_error ("template parameters cannot be friends"); + else + cp_error ("friend declaration requires `%#T'", type); + } /* Only try to do this stuff if we didn't already give up. */ if (type != integer_type_node) |

