1. 11 Feb, 1998 1 commit
    • cp-tree.h (push_template_decl): Return the decl passed in, or an equivalent duplicate. · 3ac3d9ea
      	* cp-tree.h (push_template_decl): Return the decl passed in, or an
      	equivalent duplicate.
      	* decl.c (pushtag): Use the return value from push_template_decl.
      	(duplicate_decls): When duplicating a template declaration, merge
      	the DECL_TEMPLATE_RESULTs as well.
      	(make_implicit_typename): Don't try to dive into typename types to
      	find a context for making a new implicit typename.
      	(start_decl): Use the return value from push_template_decl.
      	(grokdeclarator): Complain about declarations list `const operator
      	int'.  Since we don't correctly handle in-class initializations of
      	non-static data members, complain about this (now illegal)
      	practice.  Issue an error for initializations of non-const statics
      	since that is illegal as well, and since we don't handle that case
      	correctly either.
      	(start_function): Use the return value from push_template_decl.
      	(start_method): Likewise.
      	* decl2.c (grokfield): Likewise.  Since the change to
      	grokdeclarator ensures that all initialized fields are in fact
      	static, remove a redundant test for TREE_PUBLIC.
      	* parse.y (initlist): Disable labeled initializers since they do
      	not work as per the documentation, and since they do not use the
      	same syntax as the C front end.
      	* pt.c (push_template_decl): Return the decl passed in, or an
      	equivalent duplicate.
      	(lookup_template_class): When searching in a nested context,
      	use the right arguments.
      	(uses_template_parms): Handle the DECL_INITIAL for a CONST_DECL.
      	* typeck.c (build_component_ref): Assign the correct type to the
      	result of build_vfn_ref.
      
      From-SVN: r17852
      Mark Mitchell committed
  2. 10 Feb, 1998 2 commits
  3. 07 Feb, 1998 1 commit
  4. 03 Feb, 1998 2 commits
  5. 02 Feb, 1998 3 commits
    • call.c (add_template_candidate_real): Pass extra parameter to fn_type_unification. · d7684f2d
      	* call.c (add_template_candidate_real): Pass extra parameter to
      	fn_type_unification.
      	* cp-tree.h (fn_type_unification): Add parameter.
      	* pt.c (fn_type_unification): Add additional parameter to deal with
      	static member functions.
      	(get_bindings): Deal with static member functions.
      
      From-SVN: r17609
      Mark Mitchell committed
    • cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro. · 8857f91e
      	* cp-tree.h (DECL_NONSTATIC_MEMBER_FUNCTION_P): New macro.
      	(revert_static_member_fn): Declare.
      	* decl.c (revert_static_member_fn): Remove declaration.  Change
      	linkage from internal to external.
      	(cp_finish_decl): Deal with virtual functions in classes local to
      	template functions.
      	* decl2.c (finish_file): Don't forget to emit increment/decrement
      	expressions in initializers for file-scope variables.
      	* parse.y (typename_sub2): If the typename doesn't names a
      	template, rather than a type, issue an error message.
      	* pt.c (check_explicit_specialization): Handle specializations of
      	static member functions.
      	(coerce_template_parms): Handle offset references to lists of
      	member functions.
      	* search.c (note_debug_info_needed): Don't crash when handed a
      	type which is being defined.
      	* typeck.c (complete_type): Don't crash when handed NULL_TREE;
      	that can happen with some illegal code.
      
      From-SVN: r17598
      Mark Mitchell committed
  6. 29 Jan, 1998 2 commits
    • pt.c (convert_nontype_argument): Move check for is_overloaded_fn early to avoid bogus error. · 7bf2682f
      	* pt.c (convert_nontype_argument): Move check for is_overloaded_fn
      	early to avoid bogus error.  Handle overloaded function
      	names provided as template arguments correctly.
      	(coerce_template_parms): Don't mishandle overloaded functions when
      	dealing with template template parameters.
      	(lookup_template_class): Issue an error message, rather than
      	crashing, when the TYPE_DECL provided is not a template type.
      
      From-SVN: r17552
      Mark Mitchell committed
    • class.c (instantiate_type): Don't just return a known type if it's wrong. · abff8e06
      	* class.c (instantiate_type): Don't just return a known type if
       	it's wrong.
      	* class.c (instantiate_type): Remove handling of FUNCTION_DECL
      	since that code could never be reached.
      	* error.c (dump_decl): Avoid aborting in the midst of printing an
      	error message about an illegal template declaration.
      	* parse.y (structsp): Print an error message, rather than crashing,
      	when a class-head does not name a class.
      	* pt.c (convert_nontype_argument):  Allow REAL_TYPE and COMPLEX_TYPE
      	template arguments as a g++ extension.
      	* cp-tree.def (ALIGNOF_EXPR): New tree code.
      	* decl2.c (grok_alignof): If processing_template_decl, just store
      	the expression.
      	* typeck.c (c_alignof): Likewise.
      	* decl2.c (build_expr_from_tree): Handle ALIGNOF_EXPR.
      	* error.c (dump_expr): Likewise.
      	* pt.c (tsubst_copy): Likewise.
      	* tree.c (cp_tree_equal): Likewise.
      	* pt.c (uses_template_parms): Correctly determine whether or not a
      	SIZEOF_EXPR/ALIGNOF_EXPR uses template parameters so that constant
      	folding can be done.
      
      From-SVN: r17545
      Jason Merrill committed
  7. 28 Jan, 1998 1 commit
    • cp-tree.h (grok_enum_decls): Remove type parameter. · 86052cc3
      	* cp-tree.h (grok_enum_decls): Remove type parameter.
      	* decl.c (grok_enum_decls): Likewise.
      	* decl2.c (grok_x_components): Call grok_enum_decls
      	unconditionally, since it will do nothing if there is no
      	current_local_enum.  Use the new calling sequence.
      	* pt.c (tsubst_enum): Use the new calling sequence for
      	grok_enum_decls.
      	* decl.c (start_function): Make member functions of local classes
      	in extern inline functions have comdat linkage here...
      	(grokdeclarator): Rather than here.
      	* pt.c (convert_nontype_argument): Use decl_constant_value.
      
      From-SVN: r17531
      Jason Merrill committed
  8. 27 Jan, 1998 2 commits
    • call.c (add_template_candidate_real): New function. · e1467ff2
      	* call.c (add_template_candidate_real): New function.
      	(add_template_candidate): Use it.
      	(add_template_conv_candidate): Likewise.
      	(joust): Pass extra argument to more_specialized.
      	* class.c (instantiate_type): Handle a single FUNCTION_DECL.
      	(is_local_class): Remove.
      	(finish_struct): Check TI_PENDING_SPECIALIZATION_FLAG.
      	* cp-tree.h (is_local_class): Remove.
      	(perform_array_to_pointer_conversion): Likewise.
      	(finish_member_template_decl): Add.
      	(check_explicit_specialization): Return a tree, not an int.
      	(more_specialized): Take additional argument.
      	(get_bindings): Likewise.
      	(TI_PENDING_SPECIALIZATION_FLAG): New macro.
      	* cvt.c (perform_qualification_conversions): Use comp_ptr_ttypes.
      	(perform_array_to_pointer_conversion): Remove.
      	* decl.c (saved_scope): Add processing_specialization,
      	processing_explicit_instantiation fields.
      	(maybe_push_to_top_level): Save them.
      	(pop_from_top_level): Restore them.
      	(grokfndecl): Use new return value from
      	check_explicit_specialization.
      	(start_decl): Don't check flag_guiding_decls before pushing
      	decls.
      	(cp_finish_decl): Remove previous (bogus) change.
      	(grok_declarator): Use decl_function_context rather than
      	is_local_class.
      	* decl2.c (finish_file): Pass extra argument to get_bindings.
      	(build_expr_from_tree): Let build_x_component_ref check
      	validity of arguments rather than doing it here.
      	* lex.c (cons_up_default_function): Remove code fooling with
      	processing_specialization, processing_explicit_instantiation
      	flags, as that is now done in {maybe_push_top,pop_from}_top_level.
      	* method.c (build_overload_identifier): Mangle local classes in
      	template functions correctly.
      	* parse.y (finish_member_template_decl): Move to pt.c.
      	* pt.c (finish_member_template_decl): Moved here from parse.y.
      	(print_candidates): New function.
      	(determine_specialization): Change interface.  Properly look for
      	most specialized versions of template candidates.
      	(check_explicit_specialization): Fully process explicit
      	instantiations.
      	(push_template_decl): Avoid looking at CLASSTYPE fields in
      	FUNCTION_DECLS.
      	(determine_overloaded_function): Remove.
      	(convert_nontype_argument): Change name from
      	convert_nontype_parameter.  Use determine_overloaded_function
      	instead of instantiate_type.
      	(mangle_class_name_for_template): Handle type contexts as well as
      	function contexts.
      	(classtype_mangled_name): Likewise.
      	(lookup_template_class): Likewise.
      	(tsubst): Likewise.
      	(more_specialized): Take explict template arguments as a
      	parameter.
      	(most_specialized): Likewise.
      	(get_bindings): Likewise.  Check that return types match before
      	proclaiming a function a match.
      	(do_decl_instantiation): Remove code searching for function to
      	instantiate; that is now done in check_explicit_specialization.
      	(add_maybe_template): Pass extra argument to get_bindings.
      	* tree.c (really_overloaded_fn): Use is_overloaded_fn to simplify
      	implementation.
      	* typeck.c (build_component_ref): Check for invalid arguments.
      
      From-SVN: r17512
      Mark Mitchell committed
    • pt.c (type_unification_real): Just accept function parms that don't use any template parms. · 343c89cd
      	* pt.c (type_unification_real): Just accept function parms that
      	don't use any template parms.
      
      From-SVN: r17500
      Jason Merrill committed
  9. 24 Jan, 1998 1 commit
  10. 22 Jan, 1998 1 commit
    • pt.c (coerce_template_parms): Don't access elements of ARGLIST that is not really present. · 73b0fce8
      Wed Jan 21 10:29:57 1998  Kriang Lerdsuwanakij  <lerdsuwa@scf.usc.edu>
      	* pt.c (coerce_template_parms): Don't access elements of ARGLIST
      	that is not really present.  Substitute default arguments in
      	template template arguments.  Correctly convert TEMPLATE_DECL to
      	TEMPLATE_TEMPLATE_PARM.
      	(comp_template_args): TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM
      	are no longer treated specially here.
      	* parse.y (template_template_parm): Fix copy error.
      	* decl.c (grokdeclarator): Warn about missing `typename' for nested
      	type created from template template parameters.
      	* parse.y (bad_parm): Likewise
      	* class.c (finish_struct): Handle TEMPLATE_TEMPLATE_PARM.
      	(push_nested_class): Likewise.
      	* cp-tree.def (TEMPLATE_TEMPLATE_PARM): New tree code.
      	* cp-tree.h (DECL_TEMPLATE_TEMPLATE_PARM_P): New macro.
      	(copy_template_template_parm): Declare.
      	* decl.c (arg_looking_for_template): New variable.
      	(lookup_name_real): Handle TEMPLATE_TEMPLATE_PARM.
      	Try to return TEMPLATE_DECL or TEMPLATE_TEMPLATE_PARM
      	node if arg_looking_for_template is nonzero.
      	(pushdecl): Handle TEMPLATE_TEMPLATE_PARM.
      	(grok_op_properties, xref_tag, xref_basetypes): Likewise.
      	(grokdeclarator): Handle TEMPLATE_DECL.
      	* decl2.c (constructor_name_full): Handle TEMPLATE_TEMPLATE_PARM.
      	* error.c (dump_type): Add TEMPLATE_DECL and TEMPLATE_TEMPLATE_PARM.
      	(dump_type_prefix, dump_type_suffix) Handle TEMPLATE_TEMPLATE_PARM.
      	(dump_decl): Handle unnamed template type parameters.
      	Handle template template parameters.
      	(dump_function_name): Handle template template parameters.
      	* init.c (is_aggr_typedef, is_aggr_type, get_aggr_from_typedef):
      	Handle TEMPLATE_TEMPLATE_PARM.
      	* method.c (build_template_template_parm_names): New function.
      	(build_template_parm_names): Handle TEMPLATE_DECL.
      	(build_overload_nested_name, build_overload_name):
      	Handle TEMPLATE_TEMPLATE_PARM.
      	* parse.y (maybe_identifier): New nonterminal.
      	(template_type_parm): Use it.
      	(template_template_parm, template_arg1): New nonterminal.
      	(template_parm): Add template_template_parm rules.
      	(template_arg): Set processing_template_arg.
      	(template_arg1): Rules moved from template_arg.
      	(primary, nonnested_type): Set arg_looking_for_template if we are
      	processing template arguments.
      	* pt.c (begin_member_template_processing): Handle TEMPLATE_DECL.
      	(process_template_parm): Handle template template parameters.
      	(coerce_template_parms, comp_template_args): Likewise.
      	(mangle_class_name_for_template, lookup_template_class): Likewise.
      	(uses_template_parms): Handle TEMPLATE_DECL and
      	TEMPLATE_TEMPLATE_PARM.
      	(current_template_args): Handle TEMPLATE_DECL.
      	(tsubst, tsubst_copy, unify): Handle TEMPLATE_TEMPLATE_PARM.
      	* search.c (dfs_walk, dfs_record_inheritance):
      	Handle TEMPLATE_TEMPLATE_PARM.
      	* tree.c (copy_template_template_parm): New function.
      	(mapcar): Handle TEMPLATE_TEMPLATE_PARM.
      	* typeck.c (comptypes): Handle TEMPLATE_TEMPLATE_PARM.
      
      From-SVN: r17441
      Kriang Lerdsuwanakij committed
  11. 19 Jan, 1998 1 commit
    • decl.c (start_decl): Don't allow duplicate definitions of static data members. · 75650646
      	* decl.c (start_decl): Don't allow duplicate definitions of static
      	data members.
      	* call.c (build_user_type_conversion_1): Handle user-defined
      	template conversion operators correctly.
      	* decl2.c (build_expr_from_tree): Issue an error message if the
      	object in a COMPONENT_REF is a TEMPLATE_DECL.
      	* typeck.c (incomplete_type_error): Handle TEMPLATE_TYPE_PARMs.
      	* class.c (is_local_class): New function.
      	* cp-tree.h (is_local_class): Declare it.
      	(last_tree): Likewise.
      	(begin_tree): Likewise.
      	(end_tree): Likewise.
      	(lookup_template_class): Change prototype.
      	* decl.c (cp_finish_decl): Check for NULL where necesary.
      	Consider FUNCTION_DECLS to declare objects with top-level binding,
      	when calling make_decl_rtl.
      	(grokdeclarator): Give members of local classes internal linkage.
      	(start_function): Remove declaration of last_tree.
      	(finish_function): Set flag_keep_inline_functions around call to
      	rest_of_compilation if we are processing a member function in a
      	local class.
      	(start_method): Call push_template_decl for member functions of
      	local classes in template functions.
      	* decl2.c (import_export_decl): Don't give external linkage to
      	instantiations of templates with internal linkage.
      	* parse.y (last_tree): Remove declaration.
      	(template_type): Pass extra parameter to lookup_template_class.
      	(self_template_type): Likewise.
      	(structsp): Move call to reset_specialization into left_curly.
      	(left_curly): Call reset_specialization, and begin_tree.
      	* pt.c (saved_trees): New variable.
      	(mangle_class_name_for_template): Change prototype.  Use
      	additional function context to name local classes in templates
      	correctly.
      	(classtype_mangled_name): Pass the context.
      	(push_template_decl): Handle local classes and templates, and
      	member functions for such classes.
      	(convert_nontype_parameter): Fix handling of pointer-to-member
      	constants.
      	(lookup_template_class): Handle local classes in templates.
      	(tsubst): Likewise.  Don't assume that template instantiations
      	have external linkage; pay attention to the template declaration.
      	(mark_decl_instantiated): Likewise.
      	(begin_tree): New function.
      	(end_tree): Likewise.
      	* decl.c (xref_basetypes): Don't call complete_type for basetypes
      	that involve template parameters; that can lead to infinite
      	recursion unnecessarily.
      	* pt.c (register_specialization): Do not register specializations
      	that aren't ready to be registered yet.
      	(check_explicit_specialization): Handle explicit specialization of
      	constructors and destructors.
      	(build_template_decl): New function.
      	(push_template_delc): Handle out-of-class specializations of
      	member templates.
              * pt.c (check_explicit_specialization): Set up the template
              information before registering the specialization.
              (coerce_template_parms): Fix thinko.
              (tsubst): Handle specializations of member templates correctly.
      	* class.c (finish_struct_methods): Remove calls to
      	check_explicit_specialization from here.
      	(finish_struct): And insert them here.
      	* cp-tree.h (perform_qualification_conversions): New function.
      	(perform_array_to_pointer_conversion): Likewise.
      	(begin_explicit_instantiation): Likewise.
      	(end_explicit_instantiation): Likewise.
      	(determine_specialization): Renamed from
      	determine_explicit_specialization.
      	(comp_template_parms): New function.
      	(processing_explicit_instantiation): New variable.
      	* cvt.c (perform_qualification_conversions): New function.
      	(perform_array_to_pointer_conversion): Likewise.
      	* decl.c (duplicate_decls): Don't consider template functions
      	alike unless they have the same parameters.  Refine handling of
      	instantiation/specialization mismatches.
      	(start_decl): Don't call pushdecl for template specializations,
      	since they don't affect overloading.
      	(start_function): Likewise
      	(grokfndecl): Call check_explicit_specialization a little later.
      	Don't call duplicate_decls for memberm template specializations.
      	(grokdeclarator): Don't update template_count for classes that are
      	themselves specializations.  Remove use of `2' as parameter to
      	grokfndecl since that value isn't used.
      	* lex.c (cons_up_default_function): Save and restore
      	processing_explicit_instantiation around calls to grokfield.
      	* parse.y (finish_member_template_decl): New function.
      	(component_decl_1): Use it.
      	(fn.def2): Likewise.
      	(template_arg_list_opt): New nonterminal.
      	(template_type): Use it.
      	(self_template_type): Likewise.
      	(template_id): Likewise.
      	(object_template_id): Likewise.
      	(notype_template_declarator): Likwise.
      	(begin_explicit_instantiation): Likewise.
      	(end_explicit_instantiation): Likewise.
      	(explicit_instantiation): Use them.
      	* pt.c (coerce_template_parms): Add parameters.
      	(processing_explicit_instantiation): New variable.
      	(convert_nontype_parameter): New function.
      	(determine_overloaded_function): Likewise.
      	(begin_explicit_instantiation): Likewise.
      	(end_explicit_instantiation): Likewise.
      	(retrieve_specialization): Likewise.
      	(register_specialization): Likewise.
      	(processing_explicit_specialization): Removed.
      	(determine_specialization): Handle specializations of member
      	functions of template class instantiations.
      	(check_explicit_specialization): Refine to conform to standard.
      	(comp_template_parms): New function.
      	(coerce_template_parms): Call convert_nontype_parameter.
      	(tsubst): Refine handling of member templates.  Use
      	register_specialization.
      	(instantiate_template): Use retrieve_specialization.
      	(do_decl_instantiation): Likewise.
      	(instantiate_decl): Likewise.
      	(type_unification): Improve handling of explict template
      	arguments.
      	* tree.c (mapcar): Return error_mark_node, rather than aborting,
      	on VAR_DECLS, FUNCTION_DECLS, and CONST_DECLS.
      	* typeck.c (build_unary_op): Call determine_specialization, rather
      	than determine_explicit_specialization.
      
      From-SVN: r17426
      Mark Mitchell committed
  12. 18 Dec, 1997 2 commits
  13. 17 Dec, 1997 1 commit
  14. 15 Dec, 1997 3 commits
  15. 12 Dec, 1997 1 commit
    • decl2.c (comdat_linkage): Also set DECL_COMDAT. · ab23f787
      	* decl2.c (comdat_linkage): Also set DECL_COMDAT.
      	(finish_file): Check DECL_COMDAT instead of weak|one_only.
      	(import_export_vtable): Use make_decl_one_only instead of
       	comdat_linkage for win32 tweak.
      	(import_export_decl): Likewise.
      	* pt.c (mark_decl_instantiated): Likewise.
      
      Fix libgcc with -O3.
      
      From-SVN: r17056
      Jason Merrill committed
  16. 11 Dec, 1997 1 commit
  17. 08 Dec, 1997 2 commits
  18. 07 Dec, 1997 2 commits
    • [multiple changes] · 79a7c7fa
      Sun Dec  7 01:46:33 1997  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>
      
      	* typeck.c (build_binary_op_nodefault, pointer_diff): Symmetric
      	handling of pointer difference expressions.
      
      	* typeck.c (comp_target_types): Comparison of function/method types
      	is independent of nptrs.
      
      Sun Dec  7 01:40:27 1997  Mark Mitchell  <mmitchell@usa.net>
      
      	* pt.c (tsubst): Avoid creating pointer to reference and
      	reference to reference types.
      
      From-SVN: r16990
      Jason Merrill committed
    • Merge from gcc-2.8 · 956d6950
      From-SVN: r16987
      Jeff Law committed
  19. 03 Dec, 1997 2 commits
  20. 28 Nov, 1997 1 commit
  21. 27 Nov, 1997 3 commits
  22. 18 Nov, 1997 1 commit
  23. 12 Nov, 1997 2 commits
  24. 11 Nov, 1997 2 commits
    • call.c (build_new_method_call): Handle getting a TEMPLATE_ID_EXPR around a TEMPLATE_DECL. · 00d3396f
      	* call.c (build_new_method_call): Handle getting a
       	TEMPLATE_ID_EXPR around a TEMPLATE_DECL.  Don't look for a field
       	if we got template parms.
      	* typeck.c (build_x_function_call): Remember the TEMPLATE_ID_EXPR,
       	not just the args.
      	* decl2.c (build_expr_from_tree): Tweak last change.
      	* pt.c (tsubst_copy): Use get_first_fn instead of TREE_VALUE.
      	(maybe_fold_nontype_arg): Split out from tsubst_copy.
      	* tree.c (get_first_fn): Just return a TEMPLATE_ID_EXPR.
      
      Mon Nov 10 20:08:38 1997  Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
      
      	* pt.c (tsubst_copy): Handle explicit template arguments in
      	function calls.
      	* typeck.c (build_x_function_call): Likewise.
      	* decl2.c (build_expr_from_tree): Lookup function name if it
      	hasn't been done.
      
      	* pt.c (tsubst): Instantiate template functions properly when
      	template parameter does not appear in function arguments and return
      	type.
      	(comp_template_args): Handle member templates required by tsubst.
      
      From-SVN: r16427
      Jason Merrill committed
    • decl.c (grokdeclarator): Tweak conditions for pedwarn in previous change. · 343fdf03
      	* decl.c (grokdeclarator): Tweak conditions for pedwarn in
       	previous change.
      
      Mon Nov 10 20:08:29 1997  Bruno Haible  <bruno@linuix.mathematik.uni-karlsruhe.de>
      
      	* pt.c (coerce_template_parms): Tweak error message.
      
      	* decl.c (grokdeclarator): If -Wreturn-type, warn everytime a
      	return type defaults to `int', even if there are storage-class
      	specifiers.
      
      From-SVN: r16425
      Jason Merrill committed