aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/error.c
AgeCommit message (Collapse)Author
1999-08-07 * decl.c (bad_specifiers): It's OK to have an EH spec on a functionjason
pointer. * pt.c (maybe_get_template_decl_from_type_decl): Make sure that we're looking at a class. * decl.c (lookup_name_real): Set the complain flag if we're looking for a namespace member. * decl.c (pushdecl): Only give an error for shadowing a parm from *this* function. * decl2.c (build_expr_from_tree, case METHOD_CALL_EXPR): Only build_expr_from_tree on the args of a TEMPLATE_ID_EXPR. * class.c (mark_overriders): Fix order of args to overrides. (warn_hidden): Likewise. Fix for having virtual and non-virtual functions with the same name. * cp-tree.h (DECL_VIRTUAL_CONTEXT): New macro. * typeck.c (expand_ptrmemfunc_cst): Calculate delta correctly for virtual functions and MI. Simplify. * typeck.c (c_expand_return): Downgrade pedwarn about returning NULL from op new to warning. * decl2.c (reparse_absdcl_as_casts): Don't warn about old-style casts in system headers or extern "C" blocks. * pt.c (do_decl_instantiation): Downgrade duplicate instantiation errors to pedwarn. * error.c (dump_type_real): Handle TREE_LIST again. * typeck.c (comp_target_parms): Don't complain about converting from () to (...) if !flag_strict_prototype. * class.c (instantiate_type): Downgrade errors for object-dependent memfn refs to pedwarn. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-2_95-branch@28563 138bc75d-0d04-0410-961f-82ee72b054a4
1999-05-10 * init.c (build_offset_ref): Wrap baselinks in OFFSET_REF, too.jason
Don't bother wrapping an OFFSET_TYPE around unknown_type_node. (resolve_offset_ref): Don't handle a raw baselink. * cvt.c (build_expr_type_conversion): Likewise. * typeck.c (decay_conversion, build_c_cast, convert_for_assignment, convert_for_initialization): Likewise. * class.c (instantiate_type): Handle seeing a baselink under an OFFSET_REF. * error.c (dump_expr): Likewise. * pt.c (for_each_template_parm): Likewise. (resolve_overloaded_unification): Likewise. * tree.c (is_overloaded_fn, really_overloaded_fn): Likewise. * typeck.c (expr_sizeof): Also complain about other permutations of overloaded functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26861 138bc75d-0d04-0410-961f-82ee72b054a4
1999-04-22 * cp-tree.h (lang_decl_flags): Remove returns_first_arg andmmitchel
preserves_first_arg. Enlarge dummy accordingly. (DECL_TINFO_FN_P): New macro. (SET_DECL_TINO_FN_P): Likeiwse. (DECL_RETURNS_FIRST_ARG): Remove. (DECL_PRESERVES_THIS): Likewise. (DECL_INIT_PRIORITY): New macro. (finish_struct_1): Change prototype. (cat_namespace_levels): Remove prototype. (vtable_decl_p): New prototype. (vtype_decl_p): Likewise. (sigtable_decl_p): Likewise. (walk_globals_pred): New typedef. (walk_globals_fn): Likewise. (walk_globals): New prototype. (walk_namespaces_fn): New typedef. (walk_namespaces): New prototype. (wrapup_globals_for_namespace): Likewise. (walk_vtables): Remove prototype. (walk_sigtables): Likewise. (instantiate_pending_templates): New prototype. * class.c (finish_struct_1): Don't return a value. * decl.h (pending_statics): Remove declaration. * decl.c (walk_namespaces_r): New function. (walk_globals_r): Likewise. (vtable_decl_p): Likewise. (vtype_decl_p): Likewise. (sigtable_decl_p): Likewise. (walk_namespaces): Likewise. (walk_globals_data): New type. (walk_globals): New function. (wrapup_globals_for_namespace): Likewise. (expand_static_init): Remove assertion. Remove redundancy in conditional. Don't put static data members in static_aggregates Tidy. (finish_function): Remove redundancy in conditional. Don't set DECL_RETURNS_FIRST_ARG. (cat_namespace_levels): Remove. * decl2.c: Include splay-tree.h and varray.h. (priority_info_s): New structure. (finish_vtable_vardecl): Change prototype. Adjust for new calling conventions. (prune_vtable_vardecl): Likewise. (finish_sigtable_vardecl): Likewise. (setup_initp): Remove. (do_dtors): Remove. (do_ctors): Remove. (start_static_storage_duration_function): New function. (generate_inits_for_priority): Likewise. (finish_static_storage_duration_function): Likewise. (get_priority_info): Likewise. (do_static_initialization): Likewise. (do_static_destruction): Likewise. (do_static_initialization_and_destruction): Likewise. (generate_ctor_or_dtor_function): Likewise. (generate_ctor_and_dtor_functions_for_priority): Likewise. (pending_statics): Make it a varray. (pending_statics_used): New variable. (saved_inlines): Make it a varray. (saved_inlines_used): New variable. (finish_static_data_member): Change method of updating pending_statics. (mark_inline_for_output): Remove #if 0'd code. Change method of updating saved_inlines. (walk_vtables): Remove. (walk_sigtables): Likewise. (import_export_decl): Use DECL_TINFO_FN_P. (pending_templates): Remove declaration. (maybe_templates): Likewise. (static_aggregates_initp): Likewise. (setup_initp): Likewise. (finish_objects): Simplify. (INITIALIZE_P_IDENTIFIER): New macro. (PRIORITY_IDENTIFIER): New macro. (SSDF_IDENTIFIER): New macro. (initialize_p_decl): New variable. (priority_decl): Likewise. (ssdf_decl): Likewise. (priority_info_map): Likewise. (finish_file): Recode output of static intializers and other file-scope finalization tasks. * error.c (OB_END_TEMPLATE_ID): New macro. (dump_type_real): Use it. (dump_decl): Likewise. (dump_function_name): Likewise. * lex.c (set_typedecl_interface_info): Adjust for new walk_globals interface. (check_newline): Use walk_globals, not walk_vtables. * pt.c (pending_tempalte_expansions): Remove. (set_vardecl_interface_info): Likewise. (pending_templates): Make static. (maybe_templates): Likewise. (instantiate_class_template): Adjust call to finish_struct_1. (instantiate_pending_templates): New function. * rtti.c (get_tinfo_fn): Use SET_DECL_TINFO_FN_P. * tree.c (static_aggregates_initp): Remove. (cp_valid_lang_attribute): Don't use it; use DECL_INIT_PRIORITY instead. * Makefile.in (decl2.o): Depend on varray.h and splay-tree.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26594 138bc75d-0d04-0410-961f-82ee72b054a4
1999-04-20 * cp-tree.h (build_binary_op): Remove unneeded parameter.mmitchel
* class.c (build_vrable_entry_ref): Adjust call to build_binary_op. * decl.c (expand_static_init): Likewise. (grokdeclarator): Likewise. (finish_function): Likewise. * decl2.c (delete_sanity): Likewise. (do_dtors): Likewise. (do_ctors): Likewise. * error.c (dump_type_suffix): Likewise. * expr.c (cplus_expand_expr): Likewise. * init.c (resolve_offset_ref): Likewise. (build_new): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (expand_vec_init_catch_clause): Likewise. (build_delete): Likewise. * pt.c (tsubst): Likewise. * rtti.c (synthesize_tinfo_fn): Likewise. * search.c (expand_upcast_fixups): Likewise. (expand_direct_vtbls_init): Likewise. * typeck.c (get_member_function_from_ptrfunc): Likewise. (build_binary_op_nodefault): Likewise. (point_int_sum): Likewise. (pointer_diff): Likewise. (build_unary_op): Likewise. (build_modify_expr): Likewise. (get_delta_difference): Likewise. (build_ptrmemfunc): Likewise. (expand_ptrmemfunc_cst): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26566 138bc75d-0d04-0410-961f-82ee72b054a4
1999-04-10 * error.c (dump_type_real): If a typename is a template-id, putmmitchel
out the template arguments. (dump_expr): Handle TEMPLATE_ID_EXPR. * pt.c (lookup_template_class): Now that full arguments are available everywhere, remove code that tried to guess them. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26335 138bc75d-0d04-0410-961f-82ee72b054a4
1999-04-08 * error.c (dump_expr): Don't crash on INDIRECT_REFs whose operandsmmitchel
don't have types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26300 138bc75d-0d04-0410-961f-82ee72b054a4
1999-04-021999-04-02 Mark Mitchell <mark@codesourcery.com>mmitchel
* tinfo.h (__class_type_info): Fix illegal declaration. * cp-tree.def (TEMPLATE_ID_EXPR): Update comment. * cp-tree.h (INHERITED_VALUE_BINDING_P): New macro. (IDENTIFIER_CLASS_VALUE): Improve documentation. (is_properly_derived_from): Declare. (invalidate_class_lookup_cache): Likewise. (maybe_maybe_note_name_used_in_class): Likewise. (note_name_declared_in_class): Likewise. (push_using_decl): Remove duplicate declaration. (id_in_current_class): Remove declaration. (push_class_binding): Change prototype. (clear_identitifer_class_values): Declare. * call.c (is_properly_derived_from): Make it global. (build_new_function_call): Be careful about updating candidates. (build_new_method_call): Handle COMPONENT_REFs. Don't crash when asked to make illegal calls. * class.c: Include splay-tree.h. (class_stack_node): Add names_used slot. (check_member_decl_is_same_in_complete_scope): Remove. (add_method): Fix comment. Push the declaration into class scope. (finish_struct_1): When popping the class, pop the bindings too. Remove check for data member/function member conflict. (finish_struct): Remove calls to check_member_decl_is_same_in_complete_scope. Change calls to popclass. (pushclass): Clear names_used in the class stack entry. Use invalidate_class_lookup_cache to remove cached entries, rather than magic values with popclass. Clear IDENTIFIER_CLASS_VALUE before entering a new class. Remove dead code. Don't mess with current_function_decl when pushing declarations. (invalidate_class_lookup_cache): New function, split out from ... (popclass): Here. Clean up names_used on our way out. (instantiate_type): Adjust. (build_self_reference): Don't push the declaration here. (maybe_note_name_used_in_class): New function. (note_name_declared_in_class): Likewise. * decl.c (add_binding): Change prototype. (find_class_binding_level): New function. (innermost_nonclass_level): Likewise. (current_binding_level): Update documentation. (inner_binding_level): Remove. Replace with current_binding_level throughout. (push_binding_level): Remove special handling of class_binding_level. (pop_binding_level): Likewise. Use find_class_binding_level. (suspend_binding_level): Likewise. (global_bindings_p): Use innermost_nonclass_level. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (pseudo_global_level_p): Likewise. (push_binding): Clear INHERITED_VALUE_BINDING_P. (add_binding): Check for illegal multiple declarations. Return a value indicating whether or not the new binding was legal. (push_local_binding): Skip over class binding levels. Check return value from add_binding. (push_class_binding): Set INHERITED_VALUE_BINDING_P. Call note_name_declared_in_class. (pushlevel_class): Remove "fake out the rest of the compiler" code. (poplevel_class): Reset IDENTIFIER_CLASS_VALUEs. (clear_identifier_class_values): New function. (pop_from_top_level): Use it. (pop_everything): Tweak. (maybe_process_template_type_declaration): Don't push the declaration for the template here. (pushtag): Don't push tag declarations into class scope here. (pushdecl): Apply DeMorgan's law for readability. (pushdecl_class_level): Remove special-case code for TYPE_BEING_DEFINED. Handle OVERLOADs and anonymous unions. (push_class_level_bindng): Deal with inherited bindings. (lookup_name_real): Remove special-case code for TYPE_BEING_DEFINED, and some implicit typename magic. (grokdeclarator): Handle COMPONENT_REF for a template function. (build_enumerator): Don't call pushdecl_class_level here. (id_in_current_class): Remove. * decl2.c (grokfield): Don't call pushdecl_class_level or check_template_shadow. * errfn.c (cp_file_of): Don't declare. (cp_line_of): Likewise. * error.c (dump_decl): Handle an OVERLOAD. (cp_file_of): Likewise. (cp_line_of): Likewise. * init.c (build_member_call): Handle a COMPONENT_REF. * lex.c (do_identifier): Call maybe_note_name_used_in_class, not pushdecl_class_level. * method.c (hack_identifier): Build COMPONENT_REFs for references to member templates as well as member functions. Remove dead code. * parse.y (left_curly): Remove. (nonnested_type): Call maybe_note_name_used_in_class, not pushdecl_class_level. * parse.c: Regenerated. (nested_name_specifier_1): Likewise. * pt.c (check_explicit_specialization): Adjust, for robustness. (check_template_shadow): Handle OVERLOADs. (build_template_decl): Set DECL_CONSTRUCTOR_P on the TEMPLATE_DECL, if appropriate. * search.c (envelope_add_decl): Remove. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (dfs_push_decls): New function. (dfs_push_type_decls): Likewise. (setup_class_bindings): Likewise. (template_self_reference_p): Likewise. (lookup_field_r): Use it. (looup_member): Remove old comment. Deal with ambiguity. (push_class_decls): Use dfs_push_decls and dfs_push_type_decls, and remove envelope processing. * semantics.c (begin_class_definition): Let pushclass push declarations for base classes. (finish_member_declaration): Push declarations into class scope. * typeck.c (build_component_ref): Just put an OVERLOAD into the COMPONENT_REF, not a TREE_LIST of an OVERLOAD. (build_x_function_call): Deal with OVERLOAD. Handle template-ids. * Makefile.in (class.o): Depend on splay-tree.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@26133 138bc75d-0d04-0410-961f-82ee72b054a4
1999-03-26Warning fixes:ghazi
* call.c (op_error): Const-ify a char*. (add_candidate, source_type, add_warning): Add static prototype. (print_z_candidates): Const-ify a char*. * class.c (resolve_address_of_overloaded_function, fixed_type_or_null, build_vtable_entry_ref): Add static prototype. (get_vtable_name, finish_struct_1): Const-ify a char*. * cvt.c (convert_to_reference): Likewise. * decl.c (redeclaration_error_message, record_builtin_type, record_unknown_type, member_function_or_else, bad_specifiers): Likewise. (find_binding, select_decl, unqualified_namespace_lookup, lookup_flags, qualify_lookup, record_builtin_java_type, tag_name): Add static prototype. (warn_extern_redeclared_static, duplicate_decls, pushdecl, implicitly_declare, record_builtin_java_type, define_function, grok_op_properties, tag_name): Const-ify a char*. * cp-tree.h (FORMAT_VBASE_NAME): Allow parameter `BUF' to be const. (define_function, finish_builtin_type): Const-ify a char*. (cp_error, cp_error_at, cp_warning, cp_warning_at, cp_pedwarn, cp_pedwarn_at, cp_compiler_error, cp_sprintf): Add prototype args. (file_name_nondirectory): Const-ify a char*. (init_filename_times): Don't prototype. (compiler_error): Prototype. (yyerror, init_repo): Const-ify a char*. (build_srcloc): Don't prototype. (build_x_indirect_ref, build_indirect_ref, build_component_addr): Const-ify a char*. (warn_for_assignment): Don't prototype. (convert_for_initialization, readonly_error, check_for_new_type, GNU_xref_begin, GNU_xref_file, GNU_xref_ref, GNU_xref_call): Const-ify a char*. * decl2.c (acceptable_java_type, output_vtable_inherit, setup_initp, start_objects, finish_objects, do_dtors, do_ctors, merge_functions, decl_namespace, validate_nonmember_using_decl, do_nonmember_using_decl): Add static prototype. (lang_f_options): Const-ify a char*. (finish_builtin_type): Likewise. (add_function, arg_assoc_namespace, arg_assoc_class): Add static prototype. * errfn.c: Include cp-tree.h. (cp_thing): Add static prototype. (compiler_error): Don't protoptype. (cp_compiler_error): Cast `compiler_error' to `errorfn' before passing it to `cp_thing'. * error.c (interesting_scope_p): Add static prototype. * except.c (build_eh_type_type, build_eh_type_type_ref): Const-ify a char*. * init.c (compiler_error): Don't prototype. (member_init_ok_or_else): Const-ify a char*. (build_java_class_ref): Add static prototype. * lex.c (compiler_error): Don't prototype. (get_time_identifier, interface_strcmp, extend_token_buffer, handle_cp_pragma): Const-ify a char*. (is_global, init_filename_times): Add static prototype. (file_name_nondirectory, cplus_tree_code_name): Const-ify a char*. (compiler_error): Change from fixed args to variable args. (yyerror): Const-ify a char*. * parse.y (cond_stmt_keyword): Const-ify a char*. (parse_decl): Add static prototype. * pt.c (template_args_equal, print_template_context): Likewise. (print_candidates, check_default_tmpl_args): Const-ify a char*. (instantiate_class_template): Likewise. * repo.c (get_base_filename, open_repo_file, init_repo): Likewise. * rtti.c (call_void_fn, expand_generic_desc, expand_si_desc, expand_class_desc, expand_ptr_desc, expand_attr_desc): Likewise. * search.c (lookup_field_info, lookup_member): Likewise. (lookup_member): Cast the first argument of `bzero' to a PTR. * sig.c (compiler_error): Don't prototype. (build_signature_pointer_or_reference_nam): Const-ify a char*. (get_sigtable_name, build_member_function_pointer): Likewise. * tree.c (compiler_error): Don't prototype. (no_linkage_helper, build_srcloc): Add static prototype. (build_vbase_pointer_fields): Const-ify a char*. (__eprintf): Don't unnecessarily handle `const' when !__STDC__. * typeck.c (compiler_error): Don't prototype. (convert_for_assignment): Const-ify a char*. (comp_cv_target_types): Add static prototype. (build_x_indirect_ref, build_indirect_ref, convert_arguments, build_component_addr, build_unary_op, convert_for_initialization): Const-ify a char*. * typeck2.c (ack): Add static prototype and change from fixed args to variable args. (readonly_error, check_for_new_type): Const-ify a char*. * xref.c (_XREF_FILE, find_file, filename, fctname, declname, fixname, open_xref_file, classname, GNU_xref_begin): Likewise. (GNU_xref_file): Likewise. Also use `xmalloc' instead of `malloc'. (GNU_xref_end_scope, GNU_xref_ref, GNU_xref_decl, GNU_xref_call, gen_assign, GNU_xref_member): Const-ify a char*. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25994 138bc75d-0d04-0410-961f-82ee72b054a4
1999-03-23 * cp-tree.h (TYPE_PTRMEMFUNC_P): Use TYPE_PTRMEMFUNC_FLAG.mmitchel
Document internals of pointer-to-member-functions. (DELTA2_FROM_PTRMEMFUNC): Make it call delta2_from_ptrmemfunc. (PFN_FROM_PTRMEMFUNC): Similarly. (build_type_conversion): Remove unused parameter. (build_ptrmemfunc1): Declare. (expand_ptrmemfunc_cst): New function. (delta2_from_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. * cvt.c (cp_convert_to_pointer): Remove unused parameter to build_type_conversion. Use TYPE_PTRMEM_P for readability. (convert_to_reference): Remove unused parameter to build_type_conversion. (ocp_convert): Likewise. (build_user_type_conversion): Likewise. * error.c (dump_expr): Handle NULL pointer-to-member functions. * expr.c (cplus_expand_expr): Handle PTRMEM_CSTs for functions. * method.c (build_overload_value): Don't go splitting CONSTRUCTORs open when handling pointer-to-member functions. * pt.c (convert_nontype_argument): Clean up error messages. Be more stringent with pointers-to-members. * typeck.c (build_ptrmemfunc1): Don't declare. Make it global. (build_unary_op): Tidy ever-so-slightly. (build_conditional_expr): Remove extra parameter to build_type_conversion. (build_ptrmemfunc): Build PTRMEM_CSTs if we know what function we're using. (expand_ptrmemfunc_cst): Define. (delta2_from_ptrmemfunc): Likewise. (pfn_from_ptrmemfunc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25913 138bc75d-0d04-0410-961f-82ee72b054a4
1999-03-13 * error.c (cp_printers): Add 'F' escape character.jason
(dump_type_real): Remove TREE_LIST (fnargs) printing. Functionality moved to dump_parameters. (dump_type_suffix): Use dump_parameters and dump_exception_spec. (dump_function_decl): Extend meaning of V parameter. Use dump_parameters and dump_exception_spec. (dump_parameters): New static function. (dump_exception_spec): New static function. (fndecl_as_string): Change argument semantics. Use dump_function_decl directly. * sig.c (build_signature_table_constructor): Use cp_error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@25741 138bc75d-0d04-0410-961f-82ee72b054a4
1999-01-21 * cp-tree.h (PARM_DECL_EXPR): Delete.mmitchel
(convert_default_arg): Change prototype. (check_default_argument): Declare. (search_tree): Likewise. * call.c (convert_default_arg): Take the function to which the default argument belongs as a parameter, and do any necessary instantiation here, instead of ... (build_over_call): Here. * decl.c (local_variable_p): New function. (check_default_argument): Likewise, split out and tidied from ... (grokparms): Here. * error.c (dump_expr): Don't set PARM_DECL_EXPR. * pt.c (tsubst_call_declarator_parms): New function. (for_each_template_parm): Handle ARRAY_REFs. Do the obvious thing with CALL_EXPRs, rather than trying to be clever. (tsubst): Use tsubst_call_declarator_parms. * tree.c (search_tree): Don't make it static. * typeck.c (convert_arguments): Use new interface to convert_default_arg. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24803 138bc75d-0d04-0410-961f-82ee72b054a4
1999-01-20 * error.c (dump_function_decl): Don't print the argument types formmitchel
a function when the verbosity level is negative. * call.c (build_over_call): Check format attributes at call-time. * pt.c (tsubst_copy): Fix comment. (unify): Don't allow unification with variable-sized arrays. * semantics.c (finish_stmt_expr): When processing a template make the BIND_EXPR long-lived. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24788 138bc75d-0d04-0410-961f-82ee72b054a4
1998-12-18 * error.c (interesting_scope_p): New fn.jason
(dump_simple_decl): Use it. (dump_expr, case CONSTRUCTOR): Force a & for a PMF. (dump_expr, case OFFSET_REF): Print ->* if appropriate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24372 138bc75d-0d04-0410-961f-82ee72b054a4
1998-12-07 * decl.c (build_typename_type): Set DECL_ARTIFICIAL.jason
* error.c (dump_simple_decl): Also print namespace context. (dump_function_decl): Likewise. * decl2.c (ambiguous_decl): Don't print old value if it's error_mark_node. * decl.c (lookup_name_real): Fix handling of local types shadowed by a non-type decl. Remove obsolete code. * cp-tree.h (DECL_FUNCTION_SCOPE_P): New macro. Fixes g++.other/lookup6.C * lang-options.h: Add -fpermissive. * decl2.c: Likewise. * cp-tree.h: Add flag_permissive. * decl.c (init_decl_processing): If neither -fpermissive or -pedantic were specified, set flag_pedantic_errors. * call.c (build_over_call): Turn dropped qualifier messages back into pedwarns. * cvt.c (convert_to_reference): Likewise. * typeck.c (convert_for_assignment): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24150 138bc75d-0d04-0410-961f-82ee72b054a4
1998-12-04 * pt.c (check_template_shadow): New fn.jason
* decl2.c (grokfield): Use it. * decl.c (pushdecl): Likewise. (pushdecl_class_level): Likewise. (start_method): Likewise. (xref_tag): Don't try to use 't' if we're defining. Fixes Sec14/7/C14387.cm. * call.c (check_dtor_name): Just return an error_mark_node. * pt.c (lookup_template_class): Complain about using non-template here. * parse.y (apparent_template_type): Not here. Fixes Sec14/C14339.cm. * pt.c (check_explicit_specialization): Complain about specialization with C linkage. Fixes Sec14/C14340.cm. * lang-options.h: Add -f{no-,}implicit-inline-templates. * pt.c (convert_nontype_argument): Don't assume that any integer argument is intended to be a constant-expression. Fixes Sec14/7/P14245.C. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@24086 138bc75d-0d04-0410-961f-82ee72b054a4
1998-11-17 * cp-tree.h (TYPE_ALIAS_SET): Document language-dependent uses.mmitchel
(TYPE_BINFO): Likewise. (IS_AGGR_TYPE): Tweak. (SET_IS_AGGR_TYPE): New macro. (CLASS_TYPE_P): Tweak. (lang_type): Group mark bitfields together. Remove linenum. (CLASSTYPE_SOURCE_LINE): Remove macro. (CLASSTYPE_MARKED_N): New macro. (SET_CLASSTYPE_MARKED_N): Likewise. (CLEAR_CLASSTYPE_MARKED_N): Likewise. (CLASS_TYPE_MARKED_*): Use them. (SET_CLASSTYPE_MARKED_*): Likewise. (CLEAR_CLASSTYPE_MARKED_*): Likewise. (TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO): Likewise. (TYPE_TEMPLATE_INFO): Handle TEMPLATE_TEMPLATE_PARMs as well. (TYPENAME_TYPE_FULLNAME): Use TYPE_BINFO rather than CLASSTYPE_SIZE. * class.c (class_cache_obstack): New variable. (class_cache_firstobj): Likewise. (finish_struct): Don't set CLASSTYPE_SOURCE_LINE. (pushclass): Free the cache, when appropriate. (popclass): Tidy. (maybe_push_cache_obstack): Use class_cache_obstack. * decl.c (include hash.h). (typename_hash): New function. (typename_compare): Likewise. (build_typename_type): Check the hash table to avoid creating duplicates. (build_ptrmemfunc_type): Use SET_IS_AGGR_TYPE. (grokdeclarator): Use CLASS_TYPE_P. (xref_basetypes): Likewise. (start_function): Likewise. Don't put current_class_ref on the permanent obstack. * error.c (dump_type_real): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO and TYPE_TI_ARGS. * lex.c (note_got_semicolon): Use CLASS_TYPE_P. (make_lang_type): Don't create TYPE_LANG_SPECIFIC and associated fields for types other than class types. Do clear TYPE_ALIAS_SET for types other than class types, though. * method.c (build_overload_identifier): Use CLASS_TYPE_P and TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. * pt.c (process_template_parm): Don't set CLASSTYPE_GOT_SEMICOLON. (lookup_template_class) Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. Coerce arguments on the momentary obstack. (for_each_template_parm): Use TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO. (instantiate_class_template): Calculate template arguments on the momentary obstack. Tidy. (tsubst_template_arg_vector): Use make_temp_vec. (tsubst_aggr_type): Put template arguments on the momentary obstack. (tsubst_decl): Likewise. (tsubst): Copy the array bounds index to the permanent obstack before building index types. Use new macros. (unify): Use new macros. (do_type_instantiation): Likewise. * search.c (lookup_fnfields_1): Use new macros. (dfs_pushdecls): Build envelopes on the cache obstack. (dfs_compress_decls): Use new macros. (push_class_decls): Build on the cache obstack. * semantics.c (finish_typeof): Don't set CLASSTYPE_GOT_SEMICOLON. * sign.c (build_signature_pointer_or_reference_type): Use SET_IS_AGGR_TYPE. * tree.c (make_binfo): Check CLASS_TYPE_P. (copy_template_template_parm): Adjust. (make_temp_vec): Use push_expresion_obstack. * typeck.c (complete_type): Use new macros. (comptypes): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23686 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-28 * call.c (add_function_candidate): Treat conversion functionsjason
as coming from the argument's class. * cp-tree.h (DECL_CONV_FN_P): New fn. (DECL_DESTRUCTOR_P): Also check DECL_LANGUAGE. * class.c (add_method): Use DECL_CONV_FN_P. * decl2.c (check_classfn): Likewise. * error.c (dump_function_name): Likewise. (dump_function_decl): Likewise. * pt.c (fn_type_unification): Likewise. * search.c (add_conversions): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23387 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-26 * error.c (dump_decl): Deal with TEMPLATE_DECLs that aremmitchel
VAR_DECLs. Handle vtables whose DECL_CONTEXT is not a type. * class.c (finish_struct_1): Use build_cplus_array_type to build array types. * decl.c (init_decl_processing): Likewise. * except.c (expand_end_eh_spec): Likewise. * search.c (expand_upcast_fixups): Simplify very slightly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23359 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-26 * cp-tree.def (TYPEOF_TYPE): New code.jason
* error.c (dump_type_real): Handle it. * pt.c (tsubst): Likewise. * tree.c (search_tree): Likewise. * semantics.c (finish_typeof): New fn. * parse.y (typespec): Use it. * cp-tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23343 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-23 * cplus-dem.c (work_stuff): Replace const_type and volatile_typemmitchel
with type_quals. (TYPE_UNQUALIFIED): New macro. (TYPE_QUAL_CONST): Likewise. (TYPE_QUAL_VOLATILE): Likewise. (TYPE_QUAL_RESTRICT): Likewise. (code_for_qualifier): New function. (qualifier_string): Likewise. (demangle_qualifier): Likewise. (internal_cplus_demangle): Use them. (demangle_signature): Likewise. (demangle_template_value_parm): Likewise. (do_type): Likewise. (demangle_fund_type)): Likewise. * Makefile.in (hash.h): Run gperf when necessary. * cp-tree.h (CP_TYPE_READONLY): Remove. (CP_TYPE_VOLATILE): Likewise. (CP_TYPE_QUALS): New macro. (CP_TYPE_CONST_P): Likewise. (CP_TYPE_VOLATILE_P): Likewise. (CP_TYPE_RESTRICT_P): Likewise. (CP_TYPE_CONST_NON_VOLATILE_P): Likewise. (cp_build_type_variant): Rename to ... (cp_build_qualified_type): New function. (c_apply_type_quals_to_decl): Declare. (SIGNATURE_POINTER_NAME_FORMAT): Modify to allow `restrict'. (SIGNATURE_REFERENCE_NAME_FORMAT): Likewise. (cp_type_qual_from_rid): New function. (compparms): Remove unused parameter. All callers changed. (cp_type_quals): New function. (at_least_as_qualified_p): Likewise. (more_qualified_p): Likewise. * call.c (standard_conversion): Replace calls to cp_build_type_variant with cp_build_qualified_type. Use CP_TYPE_QUALS to get qualifiers and at_least_as_qualified_p to compare them. Use CP_TYPE_* macros to check qualifiers. (reference_binding): Likewise. (implicit_conversion): Likewise. (add_builtin_candidates): Likewise. (build_over_call): Likewise. * class.c (overrides): Compare all qualifiers, not just `const', on method declarations. * cvt.c (convert_to_reference): More CP_TYPE_QUALS conversion, etc. (convert_pointer_to_real): Likewise. (type_promotes_to): Likewise. * decl.c (check_for_uninitialized_const_var): New function. (init_decl_processing): More CP_TYPE_QUALS conversion, etc. (cp_finish_decl): Use check_for_uninitialized_const_var. (grokdeclarator): More CP_TYPE_QUALS conversion, etc. Update to handle `restrict'. (grok_ctor_properties): Likewise. (grok_op_properties): Likewise. (start_function): Likewise. (rever_static_member_fn): Likewise. * decl2.c (grok_method_quals): Likewise. (grokfield): Likewise. * error.c (dump_readonly_or_volatile): Rename to ... (dump_qualifiers): New function. Handle `restrict'. (dump_type_real): Use it. (dump_aggr_type): Likewise. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_function_decl): Likewise. (cv_as_string): Likewise. * gxx.gperf: Add __restrict and __restrict__. * gxxint.texi: Document `u' as used for `__restrict', and a few other previously undocumented codes. * hash.h: Regenerated. * init.c (expand_aggr_init): More CP_TYPE_QUALS conversion, etc. (build_member_call): Likewise. (build_new_1): Likewise. * lex.c (init_parse): Add entry for RID_RESTRICT. (cons_up_default_function): More CP_TYPE_QUALS conversion, etc. (cp_type_qual_from_rid): Define. * lex.h (enum rid): Add RID_RESTRICT. * method.c (process_modifiers): Deal with `restrict'. * parse.y (primary): More CP_TYPE_QUALS conversion, etc. * parse.c: Regenerated. * pt.c (convert_nontype_argument): More CP_TYPE_QUALS conversion, etc. (tsubst_aggr_type): Likewise. (tsubst): Likewise. (check_cv_quals_for_unify): Likewise. (unify): Likewise. * rtti.c (init_rtti_processing): Likewise. (build_headof): Likewise. (get_tinfo_var): Likewise. (buidl_dynamic_cast_1): Likewise. Fix `volatile' handling. (expand_class_desc): Likewise. (expand_attr_desc): Likewise. (synthesize_tinfo_fn): Likewise. * search.c (covariant_return_p): Likewise. Fix `volatile' handling. (get_matching_virtual): Likewise. (expand_upcast_fixups): Likewise. * sig.c (build_signature_pointer_or_reference_name): Take type_quals, not constp and volatilep. (build_signature_pointer_or_reference_type): Likewise. (match_method_types): More CP_TYPE_QUALS conversion, etc. (build_signature_pointer_constructor): Likewise. (build_signature_method_call): Likewise. * tree.c (build_cplus_array_type): Likewise. (cp_build_type_variant): Rename to ... (cp_build_qualified_type): New function. Deal with `__restrict'. (canonical_type_variant): More CP_TYPE_QUALS conversion, etc. (build_exception_variant): Likewise. (mapcar): Likewise. * typeck.c (qualif_type): Likewise. (common_type): Likewise. (comptypes): Likewise. (comp_cv_target_types): Likewise. (at_least_as_qualified_p): Define. (more_qualified_p): Likewise. (comp_cv_qualification): More CP_TYPE_QUALS conversion, etc. (compparms): Likewise. (inline_conversion): Likewise. (string_conv_p): Likewise. (build_component_ref): Likewise. (build_indirect_ref): Likewise. (build_array_ref): Likewise. (build_unary_op): Likewise. (build_conditional_expr): Likewise. (build_static_cast): Likewise. (build_c_cast): Likewise. (build_modify_expr): Likewise. (convert_For_assignment): Likewise. (comp_ptr_ttypes_real): Likewise. (cp_type_quals): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23258 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-19 Revamp references to member functions.jason
* method.c (hack_identifier): Call build_component_ref for a reference to a member function. * typeck.c (build_component_ref): Only return a single function if it's static. Otherwise, return a COMPONENT_REF. (build_x_function_call): Handle a COMPONENT_REF. (build_unary_op): Handle all unknown-type things. * decl2.c (arg_assoc): Handle COMPONENT_REF. * class.c (instantiate_type): Complain if the function we get is a nonstatic member function. Remove code for finding "compatible" functions. * pt.c (tsubst_copy): Handle NOP_EXPR. * tree.c (build_dummy_object): New fn. (maybe_dummy_object): New fn. (is_dummy_object): New fn. * cp-tree.h: Declare them. * cvt.c (cp_convert_to_pointer): Use maybe_dummy_object. * error.c (dump_expr, case OFFSET_REF): Use is_dummy_object. * init.c (build_member_call): Use maybe_dummy_object and is_dummy_object. (build_offset_ref): Use maybe_dummy_object. (resolve_offset_ref): Use is_dummy_object. * typeck.c (build_x_function_call): Call build_dummy_object. (unary_complex_lvalue): Call is_dummy_object. * typeck.c (build_component_addr): Make sure field is a field. * call.c (build_new_op): Delete obsolete code. * pt.c (tsubst, TEMPLATE*PARM*): Abort if we don't have any args. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23186 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-06 * cp-tree.def (PTRMEM_CST): New tree node.mmitchel
* cp-tree.h (ptrmem_cst): New type. (lang_type): Remove local_typedecls. (dummy): Increase to 12 bits from 11. (CLASSTYPE_LOCAL_TYPEDECLS): Remove. (PTRMEM_CST_CLASS): New macro. (PTRMEM_CST_MEMBER): Likewise. (current_access_specifier): New variable. (current_class_type): Remove duplicate declaration. (finish_struct): Change prototype. (unreverse_member_declarations): New function. (pushdecl_class_level): Change prototype. (grok_enum_decls): Remove. (fixup_anonymous_union): New function. (grok_x_components): Change prototype. (tsubst_chain): Remove. (finish_member_template_decl): Likewise. (check_explicit_specialization): Fix indentation. (finish_class_definition): Change prototype. (finish_member_class_template): Likewise. (finish_member_declaration): New function. (check_multiple_declarators): Likewise. * class.c (class_stack_node_t): New type. (current_class_base): Remove. (current_class_stack): Change type. (current_access_specifier): New variable. (grow_method): Remove. (check_member_decl_is_same_in_complete_scope): Break out from finish_struct. (make_method_vec): New function. (free_method_vec): Likewise. (add_implicitly_declared_members): Break out from finish_struct_1. (free_method_vecs): New variable. (add_method): Rework for direct use from parser. (handle_using_decl): Watch for NULL_TREE while iterating through CLASSTYPE_METHOD_VEC. (finish_struct_methods): Don't build CLASSTYPE_METHOD_VEC here; just do some error-checking. (warn_hidden): Change iteration through CLASSTYPE_METHOD_VEC. (finish_struct_1): Simplify. Use add_implicitly_declared_members. (finish_struct): Change prototype. Simplify; fields and methods are already set up at this point. (init_class_processing): Set up current_class_stack. (pushclass): Save current_access_specifier. (popclass): Restore it. (currently_open_class): Simplify. (build_self_reference): Remove use of CLASSTYPE_LOCAL_TYPEDECLS. * decl.c (saved_scope): Add access_specifier. (maybe_push_to_top_level): Save it. (pop_from_top_level): Restore it. (maybe_process_template_type_declaration): Use finish_member_declaration. (pushtag): Likewise. (pushdecl_class_level): Don't return a value. (fixup_anonymous_union): Break out from grok_x_components. (shadow_tag): Use it. (xref_tag): Complain about using an elaborated type specifier to reference a template type parameter or typedef name. (xref_basetypes): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (current_local_enum): Remove. (build_enumerator): Call finish_member_declaration. (grok_enum_decls): Remove. * decl2.c (grok_x_components): Simplify. (check_classfn): Change iteration through CLASSTYPE_METHOD_VEC. (grokfield): Don't set CLASSTYPE_LOCAL_TYPEDECLS. (merge_functions): Add to comment. (arg_assoc_type): Prototype. (arg_assoc): Pass as many arguments as there are parameters. * error.c (dump_expr): Handle PTRMEM_CST. Improve handling of OFFSET_REF. * expr.c (cpls_expand_expr): Remove dead code. Handle PTRMEM_CST. * friend.c (do_friend): Lookup friends when in nested classes. Change comments. * init.c (build_offset_ref): Do lookup even for classes that are only partially defined. (decl_constant_value): Remove dead code. * method.c (build_overload_value): Remove hack where by TYPE was not a TYPE. Handle PTRMEM_CST. (build_template_parm_names): Don't pass a PARM_DECL where a TYPE should go. * parse.y (components, notype_components, component_decl, component_decl_1, component_declarator, component_declarator0): Now all are itype rather than ttype. Rework to add members to classes on the fly. (typesqpecqual_reserved): Use check_multiple_declarators. (structsp): Update class to finish_class_definition. (do_xref_defn): Unsplit into named_class_head. (access_specifier): Set current_access_specifier. * pt.c (set_current_access_from_decl): New function. (finish_member_template_decl): Don't take the parameters. (comp_template_args): Make more robust. (lookup_template_class): Don't use current_local_enum. (for_each_template_parm): Handle PTRMEM_CST. (instantiate_class_template): Use set_current_access_from_decl, finish_member_declaration and unreverse_member_declarations. Set lineno/input_filename before generating implicit member functions. (type_unification_real): Don't assume back-unification happens only for the last argument. (regenerate_decl_from_template): Call pushclass a bit earlier. (tsubst_chain): Remove. (tsubst_enum): Use set_current_access_from_decl. (set_mangled_name_for_template_decl): Fix indentation. * search.c (lookup_fnfields_1): Change iteration through CLASSTYPE_METHOD_VEC. (dfs_pushdecls): Likewise. (dfs_compress_decls): Likewise. (add_conversions): Likewise. * semantics.c (finish_class_definition): Don't take components. Change call to finish_struct. (finish_member_declaration): New function. (finish_member_class_template): Don't take template parameters. Change call to grok_x_components. Call finish_member_template_decl. (check_multiple_declarators): New function. * sig.c (append_signature_fields): Work from the TYPE_METHODS, not a passed in fieldlist. * tree.c (search_tree): Handle PTRMEM_CST. (mapcar): Likewise. * typeck.c (unary_complex_lvalue): Build PTRMEM_CSTs, not INTEGER_CSTs, for pointer-to-data members. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22869 138bc75d-0d04-0410-961f-82ee72b054a4
1998-10-03 * class.c (current_class_ptr, current_class_ref): Clarifymmitchel
documentation. * cvt.c (ocp_convert): Don't expect fold to remove all trivial NOP type conversions. * decl.c (decls_match): Use comptypes directly; ignore qualifiers on the DECL. (duplicate_decls): Remove qualifier checks on DECL. (grokdeclarator): Make the type built up include top-level qualifiers. * decl2.c (do_dtors): Fix spelling error. * error.c (dump_simple_decl): Don't look at qualifiers on the decl when printing type information. * init.c (build_new_1): Add documentation. Deal with the fact that type of allocated memory now contains qualifiers. * lex.c (is_global): Improve error-recovery. * sig.c (build_member_function_pointer): Don't cast away const on fields of sigtable_entry_type. * tree.c (lvalue_type): Don't look at top-level qualifiers on expressions. * typeck.c (decay_conversion): Likewise. (build_component_ref): Make sure the type of the COMPONENT_REF contains top-level qualifiers, as appropriate. Improve error-handling. (build_indirect_ref): Simplify. Don't strip top-level qualifiers. (build_array_ref): Likewise. (build_unary_op): Improve error-recovery. (unary_complex_lvalue): Make taking the address a bound member function an error, not a sorry. (build_conditional_expr): Look at the type qualifiers, not the qualifiers on the expression itself. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22802 138bc75d-0d04-0410-961f-82ee72b054a4
1998-09-09 * error.c (dump_type_real): Handle NAMESPACE_DECL.jason
* parse.y (base_class.1): Avoid crash on error. * decl.c (make_typename_type): If context is a namespace, the code is in error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22342 138bc75d-0d04-0410-961f-82ee72b054a4
1998-09-08 * cp-tree.h (anonymous_namespace_name): Declare.mmitchel
* decl.c: Define it. (push_namespace): Use anonymous_namespace_name, rather than local static anon_name. * error.c (dump_decl): If a namespace is named anonymous_namespace_name, call it {anonymous}. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22329 138bc75d-0d04-0410-961f-82ee72b054a4
1998-08-30 * error.c (dump_decl): Use CP_DECL_CONTEXT, not DECL_CONTEXT, whenmmitchel
comparing with global_namespace. (dump_aggr_type): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22105 138bc75d-0d04-0410-961f-82ee72b054a4
1998-07-28 * cp-tree.h (TI_USES_TEMPLATE_PARMS): Remove.mmitchel
(build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. (innermost_args): Remove is_spec parameter. (most_specialized, most_specialized_class): Remove declarations. (lookup_template_class): Add entering_scope parameter. (maybe_process_partial_specialization): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. * class.c (finish_struct): Clean up processing of member template specializations. * decl.c (pushtag): Fix formatting. (lookup_tag): Improve handling of pseudo-global levels. (make_typename_type): Adjust call to lookup_template_class. (shadow_tag): Use maybe_process_partial_specialization. (xref_tag): Improve handling of member friends. (start_function): Call push_nested_class before push_template_decl. Don't call push_template_decl for specializations. * decl2.c (grok_x_components): Don't call xref_tag for template instantiations. Handle UNION_TYPEs like RECORD_TYPEs. (grokclassfn): Use set_mangled_name_for_decl. (arg_assoc_class): Adjust call to innermost_args. (mark_used): Don't call instantiate_decl for a TEMPLATE_DECL. * error.c (dump_function_name): Improve printing of template function names. * friend.c (is_friend): Don't compare types of decls to determine friendship, unless flag_guiding_decls. (make_friend_class): Partial specializations cannot be friends. (do_friend): Use set_mangled_name_for_decl. Call push_template_decl_real instead of push_template_decl. * method.c (build_decl_overload_real): Remove prototype. Give it external linkage. (build_overload_identififer): Adjust call to innermost_args. (build_template_decl_overload): Remove. (set_mangled_name_for_decl): New function. * parse.y (.finish_template_type): New non-terminal. (template_def): Use finish_template_decl. Use template_extdef instead of extdef. (template_extdef, template_datadef): New non-terminals, containing only those rules for things which can be templates. (datadef): Tidy. (template_type, self_template_type): Use .finish_template_type. (named_class_head): Use maybe_process_partial_specialization. * pt.c (mangle_class_name_for_template): Remove context parameter. (get_class_bindings): Remove outer_args parameter. (complete_template_args): Remove. (add_outermost_template_args): New function. (register_specialization): Return the specialization. (unregister_specialization): New function. (tsubst_template_parms): Likewise. (most_specialized, most_specialized_class): Prototype here as static. (original_template): Rename to most_general_template. (tsubst_template_parms): New function. (set_mangled_name_for_template_decl): Likewise. (TMPL_ARGS_DEPTH): New macro. (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Adjust. (TMPL_ARGS_LEVEL): New macro. (SET_TMPL_ARGS_LEVEL): Likewise. (TMPL_ARG): Likewise. (SET_TMPL_ARG): Likewise. (TMPL_ARGS_DEPTH): Likewise. (finish_member_template_decl): Use finish_template_decl. (maybe_process_partial_specialization): New function, split out from tsubst. (inline_needs_template_parms): Use TMPL_PARMS_DEPTH. (maybe_begin_member_template_processing): Use new macros. (is_member_template): Likewise. (is_member_template_class): Likewise. (add_to_template_args): Likewise. Deal with multiple levels of args. (maybe_process_partial_specialization): New function. (retrieve_specialization): Add consistency check. (determine_specialization): Return full argument list. (check_explicit_specialization): Tweak friend handling. Use full argument lists. Simplify. (current_template_args): Use new macros. (push_template_decl_real): Change ill-named mainargs to specargs. Check that a partial specialization actually specializes at least one parameter. Improve friend handling. Modify for full template arguments. (classtype_mangled_name): Don't mangle the names of specializations. (lookup_template_class): Add entering_scope parameter. Use it to avoid finding a template type when an instantiation is required. Simplify. Use full template arguments. (tsubst_friend_function): Use unregister_specialization. Use new macros. Use full template arguments. (tsubst_friend_class): Substitute, using tsubst_template_parms, into the template parameters before passing them to redeclare_class_template. (instantiate_class_template): Simplify. Use full template arguments. Adjust calls to get_class_bindings. Use SET_IDENTIFIER_TYPE_VALUE where needed. Improve friend handling. (innermost_args): Use new macros. (tsubst_aggr_type): New function, split out from tsubst. (tsubst): Use tsubst_aggr_type, tsubst_template_parms, new calling conventions for lookup_tmeplate_class. Refine handling of partial instantiations. Remove calls to complete_template_args. Simplify. Add consistency checks. Use set_mangled_name_for_decl and set_mangled_name_for_template_decl. (tsubst_copy): Use tsubst_aggr_type. (instantiate_template): Use full template arguments. (more_specialized): Improve formatting. (more_specialized_class): Adjust calls to get_class_bindings. (get_bindings_real): Don't call complete_template_args. (most_specialized): Don't overwrite input; create a new list. (most_specialized_class): Use most_general_template. (regenerate_decl_from_template): Use unregister_specialization. Use full template arguments. (instantiate_decl): Use full template arguments. (set_mangled_name_for_template_decl): New function. * semantics.c (begin_class_definition): Use maybe_process_partial_specialization. (finish_member_class_template): New function. (finish_template_decl): Likewise. (finish_template_type): Likewise. (typeck.c): Don't crash after issuing a compiler_error. * Makefile.in (CONFLICTS): Adjust; we removed a s/r conflict. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21433 138bc75d-0d04-0410-961f-82ee72b054a4
1998-07-19 * error.c (dump_type_real): Don't crash when presented withmmitchel
intQI_type_node or the like. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21284 138bc75d-0d04-0410-961f-82ee72b054a4
1998-06-161998-06-16 Andrew MacLeod <amacleod@cygnus.com>amacleod
* decl.c (grokvardecl): Don't build external assembler names for TYPENAMEs in other namespaces as there is no declarator. * error.c (cp_file_of, cp_line_of): Don't extract file or line number info from DECL_CONTEXT if it is NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20524 138bc75d-0d04-0410-961f-82ee72b054a4
1998-06-101998-06-10 John Carr <jfc@mit.edu>jfc
* tree.c (debug_binfo): Make printf format match arguments. * error.c (OB_PUTI): Make printf format match arguments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20401 138bc75d-0d04-0410-961f-82ee72b054a4
1998-06-05 * cp-tree.h (DECL_NAMESPACE_ALIAS, ORIGINAL_NAMESPACE): Declare.jason
* decl.c (lookup_name_real): Add namespaces_only parameter. If set, return only NAMESPACE_DECLs. (select_decl): Likewise. (identifier_type_value): Give additional parameter. (lookup_name_nonclass): Likewise. (lookup_name): Likewise. (find_binding): Skip namespace aliases. (binding_for_name): Likewise. (push_namespace): Check for namespace aliases. (lookup_name_namespace_only): New function. (begin_only_namespace_names, end_only_namespace_names): New functions. * decl2.c (set_decl_namespace): Skip namespace aliases. (do_using_directive): Likewise. (do_namespace_alias): Produce namespace aliases, fix alias redeclaration. * error.c (dump_decl): Support SCOPE_REF. * parse.y (extdef): Wrap lookup with namespace_only for namespace aliases and using declarations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20236 138bc75d-0d04-0410-961f-82ee72b054a4
1998-06-04 * error.c (dump_expr): Clean up NEW_EXPR case.jason
* tree.c (mapcar): Support NEW_EXPR. * error.c (dump_expr): Support NEW_EXPR. * decl2.c (arg_assoc_type): Return 0 for LANG_TYPE. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20218 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-26bothner
* language_as_string: Handle lang_java. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20062 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-24 * decl.c (push_namespace): Namespaces have type void.jason
* typeck2.c (incomplete_type_error): Complain about namespace used as expression. * typeck.c (decay_conversion): Likewise. * error.c (dump_expr): Support namespaces. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@20035 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-20 * decl.c (grokfndecl): Handle definition of specialization injason
friend declaration. * error.c (dump_decl): Fix LOOKUP_EXPR handling. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19919 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-19 * class.c (is_empty_class): Return 0 if TYPE is an error_mark_node.brendan
* error.c (dump_expr): Handle an ARROW_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19885 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-13Warning patches:ghazi
* Makefile.in (lex.o): Depend on output.h. * call.c (add_function_candidate): Remove unused variable `cand'. (add_conv_candidate): Likewise. (build_builtin_candidate): Likewise. * cp-tree.h: Add prototype for `types_overlap_p'. * decl.c (signal_catch): Mark parameter `sig' with ATTRIBUTE_UNUSED. * decl2.c (merge_functions): Remove unused variables `tmp' and `tempn'. * error.c (expr_as_string): Mark parameter `v' with ATTRIBUTE_UNUSED. (code_as_string): Likewise. (language_as_string): Likewise. (parm_as_string): Likewise. (op_as_string): Likewise. (assop_as_string): Likewise. (cv_as_string): Likewise. * lex.c: Include output.h. * pt.c (type_unification): Cast first argument of `bzero' to a char*. * search.c (dfs_no_overlap_yet): Mark parameter `t' with ATTRIBUTE_UNUSED. * tinfo.cc (__class_type_info::dcast): Change the type of variable `i' from int to size_t. * typeck.c (language_lvalue_valid): Mark parameter `exp' with ATTRIBUTE_UNUSED. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19707 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-12 * error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/orjason
DECL_NAMESPACE_SCOPE_P. (lang_decl_name): Likewise. * pt.c (tsubst_friend_function, tsubst): Likewise. * decl.c (pushdecl, redeclaration_error_message, start_decl, cp_finish_decl, start_function): Likewise. * class.c (finish_struct_1): Likewise. * call.c (build_over_call): Likewise. (compare_ics): Use DERIVED_FROM_P. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19705 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-12 * error.c (dump_simple_decl): New function, broken out from ...mmitchel
(dump_decl): Use it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19694 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-08massive namespace patchjason
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19631 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-06 * error.c: Convert to using ctype macros defined in system.h.ghazi
* method.c: Likewise. * xref.c: Likewise. * lex.c: Likewise. Also remove redundant system header stuff. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19577 138bc75d-0d04-0410-961f-82ee72b054a4
1998-05-06Wed May 6 06:36:41 1998 Robert Lipe <robertl@dgii.com>robertl
* cp/call.c, cp/class.c, cp/decl.c, cp/decl2.c, cp/errfn.c, cp/error.c, cp/except.c, cp/expr.c, cp/friend.c, cp/init.c, cp/lex.c, cp/method.c, cp/pt.c, cp/repo.c, cp/rtti.c, cp/search.c, cp/semantics.c, cp/sig.c, cp/tree.c, cp/typeck.c, cp/typeck2.c, cp/xref.c: Add include of toplev.h. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19565 138bc75d-0d04-0410-961f-82ee72b054a4
1998-04-23 * error.c (dump_type_real): Declare canonical_name.jason
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19384 138bc75d-0d04-0410-961f-82ee72b054a4
1998-04-17Fri Apr 17 21:25:00 1998 Mark Mitchell <mmitchell@usa.net>mmitchel
* cp-tree.h (type_as_string_real): New function. * pt.c (mangle_class_name_for_template): Use it. * error.c (dump_aggr_type): Change prototype. (dump_type_prefix): Likewise. (dump_type_suffix): Likewise. (dump_type_real): Convert from dump_type. If desired, the "canonica" name of a typedef, i.e., the name of the underlying type, can be printed. (dump_type): Call dump_type_real. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19273 138bc75d-0d04-0410-961f-82ee72b054a4
1998-03-31 * call.c: Include system.h. Remove includes, declarations andlaw
defines provided by system.h. * class.c, cvt.c, decl.c, decl2.c, errfn.c error.c: Likewise. * except.c, expr.c friend.c, g++spec.c, init.c, input.c: Likewise. * lex.c, parse.y, pt.c, ptree.c repo.c rtti.c, search.c: Likewise. * semantics.c, sig.c, spew.c, tree.c, typeck.c: Likewise. * typeck2.c, xref.c: Likewise. * Makefile.in: Dependencies updated as appropriate. * Make-lang.in: Likewise. system.h cutover from the cp subdir git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18917 138bc75d-0d04-0410-961f-82ee72b054a4
1998-03-27 * error.c (dump_decl): Be a bit more explicit with templatemmitchel
type arguments, when verbose. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18858 138bc75d-0d04-0410-961f-82ee72b054a4
1998-03-24 * cplus-dem.c (optable): Add sizeof.mmitchel
(demangle_template_value_parm): New function containing code previously found in demangle_template. (demangle_integral_value): New function which handles complicated integral expressions. (demangle_template): Use them. * error.c (dump_expr): Remove unused variable `l'. * pt.c (for_each_template_parm): New function, created by converting uses_template_parms. (tree_fn_t): New typedef. (uses_template_parms): Use it. (mark_template_parm): New function. (push_template_decl): Check that the argument list of a partial specialization uses all the template parameters. * Make-lang.in (c++filt): Don't delete cxxmain.c after we're done with it; we might want it for debugging. * cp-tree.h (type_unification): Change interface. * class.c (finish_struct_1): Skip nested template types, just like ordinary nested types. (instantiate_type): Use new interface to type_unification. * lex.c (init_lex): Add __sz as opname for sizeof. * method.c (build_overload_scope_ref): New function. (build_overload_int): Handle complex expressions. Set numeric_output_need_bar if necessary. (build_overload_value): Handle non-PARM_DECL nodes; this routine is now used by build_overload_int. Remove some assignments to numeric_output_need_bar. Use build_overload_scope_ref. (build_qualified_name): Note that some template mangled names end with digits, and set numeric_output_need_bar appropriately. Use build_underscore_int. * pt.c (unify): Change interface. (type_unification_real): Likewise. (determine_specialization): Use new interfaces. (tsubst): Deal gracefully with situations in which the argument vector is not fully filled. (fn_type_unification): Use new interfaces. (type_unification): Likewise. Remove NOP_EXPR hack. (type_unification_real): Likewise. (unify): Likewise. Deal with unification of complex expresions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18795 138bc75d-0d04-0410-961f-82ee72b054a4
1998-02-25Partial implementation of namespaces.jason
* decl.c (push_namespace): Handle redeclaration error. * cp-tree.h (IDENTIFIER_NAMESPACE_VALUE): New macro. (IDENTIFIER_NAMESPACE_BINDINGS): New macro. (NAMESPACE_BINDING): New macro. (IDENTIFIER_GLOBAL_VALUE): Use NAMESPACE_BINDING. * *.c: Use them. * pt.c (push_template_decl): Use innermost_args. * decl.c (get_unique_name): Tweak from earlier in the name. * cp-tree.def: Add CPLUS_BINDING node. * cp-tree.h (tree_binding): new struct (BINDING_SCOPE, BINDING_VALUE): new macros (current_namespace, global_namespace): declare extern (struct lang_decl_flags): new field in_namespace (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): new macros (DECL_NAMESPACE, SET_DECL_NAMESPACE): new macros (TREE_INDIRECT_USING): new macro * decl2.c (current_namespace, global_namespace): Declare. The value is a NAMESPACE_DECL now, not a TREE_LIST. (is_namespace_ancestor, namespace_ancestor):new static functions. (add_using_namespace, ambiguous_decl): likewise. (lookup_using_namespace): new support function for lookup_name. (qualified_lookup_using_namespace): new support function for do_scoped_id and lookup_namespace_name (get_namespace_id): mark as obsolete. (current_namespace_id): Likewise. (do_namespace_alias): Implement. (do_using_directive): Implement as call to add_using_namespace. * decl.c (binding_for_name): new function. (push_namespace, pop_namespace): implement. (push_decl): don't install a FUNCTION_DECL in the global branch. (lookup_namespace_name): implement using qualified lookup. (lookup_name_real): For global scoping, lookup in global_namespace. For namespace scoping, lookup in given namespace. For unscoped lookup, iterate over namespace, considering using directives. (init_decl_processing): initialize global_namespace. (grokvardecl): Build assembler name as static name for globals. (grokdeclarator): Remove old namespace mangling. (xref_tag): When installing a global binding for the tag, make sure we have an identifier. * method.c (build_overload_nested_name): mangle namespaces. (build_qualified_name): Likewise. (build_decl_overload_real): Likewise. * lex.c (build_lang_decl): set namespace for new declaration to current_namespace. (do_scoped_id): find global names in global or current namespace, or using qualified namespace lookup, depending on context. * init.c (build_member_call): When scope is namespace, use build_x_function_call instead. (build_offset_ref): When scope is namespace, collapse processing to lookup_namespace_name instead. * error.c (dump_decl): Support NAMESPACE_DECL. * decl.c (pushdecl): Bind globals to current namespace. (push_overloaded_decl): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (xref_tag): Likewise. (start_function): Likewise. * lex.c (do_identifier): Likewise. (identifier_typedecl_value): Likewise. (real_yylex): Likewise. * method.c (do_inline_function_hair): Likewise. * parse.y (unscoped): Likewise. * pt.c (check_explicit_specialization): Likewise. (lookup_template_class): Likewise. * rtti.c (call_void_fn): Likewise. * sig.c (build_sigtable): Likewise. * ptree.c (lang_print_xnode): New function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18227 138bc75d-0d04-0410-961f-82ee72b054a4
1998-02-23Support for friend templates.jason
* typeck.c (build_x_function_call): Handle static member function templates like non-templates. Handle friend templates like normal function templates. * pt.c (tsubst, *_PARM): Don't use orig_level. (get_bindings): Don't call add_to_template_args. (instantiate_template): Likewise. (tsubst, FUNCTION_DECL): Call add_to_template_args as appropriate. * ptree.c (print_lang_type): Print index/level for template parms. * Make-lang.in (cc1plus): Note that cc1plus depends on cp/cp-tree.h and cp/cp-tree.def. * cp-tree.def (TEMPLATE_CONST_PARM): Remove. (TEMPLATE_PARM_INDEX): New tree code, used to indicate a position in a template parameter list. * cp-tree.h (template_parm_index): New structure, used as the tree structure for a TEMPLATE_PARM_INDEX. (TEMPLATE_PARM_IDX): New macro. (TEMPLATE_PARM_LEVEL): Likewise. (TEMPLATE_PARM_DESCENDANTS): Likewise. (TEMPLATE_PARM_ORIG_LEVEL): Likewise. (TEMPLATE_PARM_DECL): Likewise. (TEMPLATE_TYPE_PARM_INDEX): Likewise. (TEMPLATE_TYPE_ORIG_LEVEL): Likewise. (TEMPLATE_TYPE_DECL): Likewise. (TEMPLATE_CONST_IDX): Remove. (TEMPLATE_CONST_LEVEL): Likewise. (TEMPLATE_CONST_SET_INFO): Likewise. (TEMPLATE_TYPE_SET_INFO): Likewise. (TEMPLATE_TYPE_IDX): Redefine in terms of TEMPLATE_PARM_INDEX node. (TEMPLATE_TYPE_LEVEL): Likewise. * decl.c (decls_match): Call comp_template_parms, rather than expanding it inline. (duplicate_decls): If two template declarations are being merged, then their TEMPLATE_INFOs should be merged as well. (grokfndecl): Save template-id information when declaring a friend with explicit template arguments. Pass arguments to check_explicit_specialization via correct convention; at some point check_explicit_specialization changed, but these call-sites did not. (grokdeclarator): Tidy up slightly. * decl2.c (check_classfn): Tidy up slightly. Don't assume that two template functions with the same DECL_ASSEMBLER_NAME the same, since the names are not yet mangled. * error.c (dump_decl): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (dump_expr): Likewise. Use the TEMPLATE_PARM_DECL to get at the decl for a non-type parameter, rather than printing `<tparm ...>'. * friend.c (is_friend): Handle TEMPLATE_DECL friends. (do_friend): Deal with template friends. * lex.c (do_pending_inlines): Call maybe_begin_member_template_processing, rather than conditionally calling begin_member_template_processing. (process_next_inline): Likewise. Call maybe_end_member_template_processing, rather than conditionally calling end_member_template_processing. (do_pending_defargs): Likewise. (do_identifier): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. * method.c (build_mangled_template_parm_index): New function. (build_overload_value): Use it. (build_overload_name): Likewise. * pt.c (finish_member_template_decl): Allow friend declarations. (template_class_depth): New function. (is_member_template): Rename, and modify, to become... (is_member_or_friend_template): New function. (end_member_template_processing): Rename, and modify, to become... (maybe_end_member_template_processing). (build_template_parm_index): New function. (reduce_template_parm_level): New function. (process_template_parm): Modify to use build_template_parm_index. (current_template_args): Change name to current_template_parms. (push_template_decl): Deal with friend templates. (uses_template_parms): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (tsubst_friend_function): New function. (instantiate_class_template): Generate the DECL_FRIENDLIST for a new instantiation by using tsubst_friend_function rather than just tsubst. (tsubst): Don't tsubst into a type which is a TEMPLATE_DECL. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM, and the appropriate new macros. Use reduce_template_parm_level to generate lower-level template parameters. Handle tsubst'ing into TEMPLATE_DECLS that declare TEMPLATE_TEMPLATE_PARMS. Don't forget to tsubst the DECL_CONTEXT and DECL_CLASS_CONTEXT of newly created templates. Similarly for the template parameters for a new template. (tsubst_copy): Tidy up slightly. Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. Handle TYPE_DECLs by tsubsting into them. (unify): Use TEMPLATE_PARM_INDEX instead of TEMPLATE_CONST_PARM. (get_bindings): Call add_to_template_args if necessary. (instantiate_decl): Handle instantiations of friend templates. * search.c (lookup_field_1): Don't treat the TYPE_FIELDS of a TEMPLATE_TYPE_PARM as a list of fields; it's not! * spew.c (yylex): Do a little manual constant propogation to clarify the code. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18198 138bc75d-0d04-0410-961f-82ee72b054a4
1998-02-22 * error.c: Include sys/types.h.law
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18176 138bc75d-0d04-0410-961f-82ee72b054a4