diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1997-09-06 04:10:07 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-09-06 04:10:07 -0400 |
commit | 98c1c668807d74ad4dfab8c0413499b31f638258 (patch) | |
tree | 770f6f78bc4ec8479312fa2a69e6db566c0ed9b9 /gcc/cp/parse.y | |
parent | dbfcb4beace35e1426c1ce1e9bf2f20c7d5a0f56 (diff) | |
download | gcc-98c1c668807d74ad4dfab8c0413499b31f638258.zip gcc-98c1c668807d74ad4dfab8c0413499b31f638258.tar.gz gcc-98c1c668807d74ad4dfab8c0413499b31f638258.tar.bz2 |
class.c (grow_method): Remove check for redeclaration.
* class.c (grow_method): Remove check for redeclaration.
Fri Sep 5 01:37:17 1997 Mark Mitchell <mmitchell@usa.net>
* cp-tree.h (INNERMOST_TEMPLATE_PARMS): New macro.
(DECL_INNERMOST_TEMPLATE_PARMS): Likewise.
(PRIMARY_TEMPLATE_P): Use it.
* call.c (build_overload_call_real): Use it.
* class.c (instantiate_type): Likewise.
* decl.c (decls_match): Likewise.
* method.c (build_overload_identifier): Likewise.
* pt.c (push_template_decl): Likewise.
(classtype_mangled_name): Likewise.
(lookup_template_class): Likewise.
* cp-tree.h (DECL_NTPARMS): Change name from DECL_NT_PARMS to
DECL_NTPARMS to conform to usage elsewhere.
* call.c (add_template_candidate): Likewise.
* class.c (instantiate_type): Likewise.
* pt.c (instantiate_template): Likewise.
(get_bindings): Likewise.
* class.c (grow_method): Use DECL_FUNCTION_TEMPLATE_P instead of
is_member_template.
* pt.c (unify): Undo changes to allow multiple levels of template
parameters.
(type_unification): Likewise.
(fn_type_unification): Likewise.
(get_class_bindings): Likewise.
* cp-tree.h (Likewise).
* decl.c (replace_defarg): Check that the type of the default
parameter does not invlove a template type before complaining
about the initialization.
* error.c (dump_expr): Deal with template constant parameters in
member templates correctly.
* pt.c (is_member_template): Deal with class specializations
correctly.
(tsubst): Handle "partial instantiation" of member templates
correctly.
Wed Sep 3 12:30:24 1997 Mark Mitchell <mmitchell@usa.net>
* pt.c (type_unification): Change calling squence to allow for
multiple levels of template parameters.
(tsubst_expr): Likewise.
(tsubst): Likewise.
(tsubst_copy): Likewise.
(instantiate_template): Likewise.
(unify): Likewise.
* call.c (build_overload_call_real): Use it.
(add_builtin_candidate): Use it.
(build_new_method_call): Use it.
* class.c (instantiate_type): Use it.
* decl.c (grokdeclarator): Use it.
* decl2.c (finish_file): Use it.
* method.c (build_overload_identifier): Use it.
* call.c (add_template_candidate): Add additional parameter for
the function return type. Call fn_type_unification istead of
type_unification.
(build_user_type_conversion_1): Handle member templates.
(build_new_function_call): Likewise.
(build_new_op): Likewise.
(build_new_method_call): Likewise.
* class.c (grow_method): Don't give an error message indicating
that two member templates with the same name are ambiguous.
(finish_struct): Treat member template functions just like member
functions.
* cp-tree.h (check_member_template): Add declaration.
(begin_member_template_processing): Likewise.
(end_member_template_processing): Likewise.
(fn_type_unification): Likewise.
(is_member_template): Likewise.
(tsubst): Change prototype.
(tsubst_expr): Likewise.
(tsubst_copy): Likewise.
(instantiate_template): Likewise.
(get_bindings): Likewise.
* decl.c (decls_match): Handle multiple levels of template
parameters.
(pushdecl): Handle template type params just like other type
declarations.
(push_class_level_binding): Return immediately if the
class_binding_level is NULL.
(grokfndecl): If check_classfn() returns a member_template, use
the result of the template, not the template itself.
* decl2.c (check_member_template): New function. Check to see
that the entity declared to be a member template can be one.
(check_classfn): Allow redeclaration of member template functions
with different types; the new functions can be specializations or
explicit instantiations.
* error.c (dump_decl): Handle multiple levels of template
parameters.
(dump_function_decl): Update to handle function templates.
* lex.c (do_pending_inlines): Set up template parameter context
for member templates.
(process_next_inline): Likewise.
* method. (build_overload_identifier): Adjust for multiple levels
of template parameters.
* parse.y (fn.def2): Add member templates.
(component_decl_1): Likewise.
* pt.c (begin_member_template_processing): New function.
(end_member_template_processing): Likewise.
(is_member_template): Likewise.
(fn_type_unification): Likewise.
(current_template_parms): Return a vector of all the template
parms, not just the innermost level of parms.
(push_template_decl): Deal with the possibility of member
templates.
(lookup_template_class): Likewise.
(uses_template_parms): Likewise.
(tsubst): Modify processing to TEMPLATE_TYPE_PARM and
TEMPLATE_CONST_PARM to deal with multiple levels of template
arguments. Add processing of TEMPLATE_DECL to produce new
TEMPLATE_DECLs from old ones.
(do_decl_instantiation): Handle member templates.
* search.c (lookup_fnfields_1): Handle member template conversion
operators.
* tree.c (cp_tree_equal): Check the levels, as well as the
indices, of TEMPLATE_CONST_PARMs.
* typeck.c (comptypes): Check the levels, as well as the indices,
fo TEMPLATE_TYPE_PARMs.
(build_x_function_call): Treat member templates like member
functions.
Member templates.
From-SVN: r15130
Diffstat (limited to 'gcc/cp/parse.y')
-rw-r--r-- | gcc/cp/parse.y | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 47302a0..7d9d5db 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -699,6 +699,22 @@ fn.def2: $$ = start_method (specs, $2); goto rest_of_mdef; } | constructor_declarator { $$ = start_method (NULL_TREE, $$); goto rest_of_mdef; } + | template_header fn.def2 + { + end_template_decl (); + if ($2 && DECL_TEMPLATE_INFO ($2)) + { + $$ = DECL_TI_TEMPLATE ($2); + check_member_template ($$); + } + else if ($2) + $$ = $2; + else + { + cp_error("invalid member template declaration"); + $$ = NULL_TREE; + } + } ; return_id: @@ -2711,7 +2727,22 @@ component_decl_1: build_tree_list ($3, NULL_TREE)); } | using_decl { $$ = do_class_using_decl ($1); } - ; + | template_header component_decl_1 + { + end_template_decl (); + if ($2 && DECL_TEMPLATE_INFO ($2)) + { + $$ = DECL_TI_TEMPLATE ($2); + check_member_template ($$); + } + else if ($2) + $$ = $2; + else + { + cp_error("invalid member template declaration"); + $$ = NULL_TREE; + } + } /* The case of exactly one component is handled directly by component_decl. */ /* ??? Huh? ^^^ */ |