aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.c
AgeCommit message (Collapse)AuthorFilesLines
2003-12-13ggc-zone.c: Follow spelling conventions.Kazu Hirata1-1/+1
* ggc-zone.c: Follow spelling conventions. * config/rs6000/rs6000.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * objc/objc-act.c: Likewise. From-SVN: r74590
2003-12-12re PR c++/13118 ([ABI] Missed covariant return thunk)Nathan Sidwell1-1/+1
cp: PR c++/13118 * cp-tree.h (lang_decl_u): Add thunk_alias member. (THUNK_VIRTUAL_OFFSET): Must be a FUNCTION_DECL. (THUNK_ALIAS_P): Remove. (THUNK_ALIAS): Adjust. * class.c (update_vtable_entry_for_fn): Get the vbase within the overriding function's return type. (dump_thunk): Adjust THUNK_ALIAS printing. (build_vtbl_initializer): Adjust THUNK_ALIAS use. * method.c (make_thunk): Revert 12881 test change. Clear THUNK_ALIAS. (finish_thunk): Adjust THUNK_ALIAS setting. (use_thunk): Adjust THUNK_ALIAS use. * semantics.c (emit_associated_thunks): Likewise. testsuite: PR c++/13118 * g++.dg/abi/covariant3.C: New. From-SVN: r74576
2003-12-04re PR c++/13179 (ICE w/template parameter in catch specification)Mark Mitchell1-1/+1
PR c++/13179 * semantics.c (finish_handler_parms): Do not call eh_type_info for types used in templates. PR c++/13179 * g++.dg/template/eh1.C: New test. From-SVN: r74269
2003-11-18re PR c++/12932 (ICE with use of ptr-to-function as template arg)Kriang Lerdsuwanakij1-0/+2
PR c++/12932 * class.c (currently_open_derived_class): Check if current_class_type is NULL_TREE. * semantics.c (finish_call_expr): Check if currently_open_derived_class returns NULL_TREE. * cp-tree.h (DERIVED_FROM_P): Add parenthesis around PARENT parameter. * g++.dg/template/static5.C: New test. From-SVN: r73705
2003-10-26re PR c++/10371 (misleading error message for illegal member access)Kriang Lerdsuwanakij1-1/+8
PR c++/10371 * semantics.c (finish_non_static_data_member): Handle when both processing_template_decl and qualifying_scope are true. * g++.dg/lookup/scoped8.C: New test. From-SVN: r72950
2003-10-24PR c++/12698, c++/12699, c++/12700, c++/12566Nathan Sidwell1-7/+12
cp: PR c++/12698, c++/12699, c++/12700, c++/12566 * cp-tree.h (THUNK_ALIAS_P, THUNK_ALIAS): New. (debug_class, debug_thunks): New. * class.c (dump_class_hierarchy_1): New break out from ... (dump_class_hierarchy): ... here. (dump_thunk, debug_thunks, debug_class): New. (update_vtable_entry_for_fn): Add ssizetype casts. Correct continued search for primary binfo via virtual. (build_vtbl_initializer): Follow covariant thunk alias. * method.c (make_thunk): Clear DECL_THUNKS of the thunk. (finish_thunk): Look for an alias of the covariant thunk and point to it. (use_thunk): We should never use an alias. * semantics.c (emit_associated_thunks): Do not emit aliases. PR c++/12566 * cp-tree.h (cp_fname_init): Add TYPE pointer param. * decl.c (cp_fname_init): Add TYPE pointer param. Set it. Don't create an ad-hoc ERROR_MARK. (cp_make_fname_decl): Adjust. * pt.c (tsubst_expr): Adjust. testsuite: PR c++/12698, c++/12699, c++/12700, c++/12566 * g++.dg/inherit/covariant9.C: New test. * g++.dg/inherit/covariant10.C: New test. * g++.dg/inherit/covariant11.C: New test. From-SVN: r72882
2003-10-22call.c: Fix comment formatting.Kazu Hirata1-1/+1
* call.c: Fix comment formatting. * class.c: Likewise. * cxx-pretty-print.c: Likewise. * init.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. From-SVN: r72828
2003-10-21ChangeLog: Fix typos.Kazu Hirata1-3/+3
* ChangeLog: Fix typos. * call.c: Fix comment typos. * class.c: Likewise. * cp-tree.h: Likewise. * cvt.c: Likewise. * cxx-pretty-print.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * parser.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * tree.c: Likewise. * typeck.c: Likewise. From-SVN: r72737
2003-09-23cp-tree.h (scope_kind): Add new enumerator.Gabriel Dos Reis1-3/+3
* cp-tree.h (scope_kind): Add new enumerator. (keep_next_level): Change parameter type to bool. (begin_scope): Change prototype. (pushlevel): Remove declaration. * decl.c (push_binding_level): Fold in begin_scope. Remove. (struct cp_binding_level): Remove tag_tranparent field. Make keep of bitsize one. (keep_next_level_flag): Make a bool. (cxx_scope_descriptor): Update scope names table (make_cxx_scope): Fold in begin_scope. Remove.. (namespace_scope_ht_size): New function. (begin_scope): Change prototype. Return a scope. Tidy. (kept_level_p): Update. (pushlevel): Remove. (maybe_push_cleanup_level): Simplify. (poplevel): Update for sk_cleanup and keep change. (print_binding_level): Likewise. (initial_push_namespace_scope): Fold in begin_scope. Remove. (push_namespace): Update. (pushtag): Likewise. (lookup_tag): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (cxx_init_decl_processing): Likewise. (start_function): Likewise. (begin_function_body): Likewise. (start_method): Likewise. * pt.c (push_inline_template_parms_recursive): Likewise. (begin_template_parm_list): Likewise. (begin_specialization): Likewise. * semantics.c (do_pushlevel): Likewise. (begin_compound_stmt): Likewise. (begin_stmt_expr): Likewise. From-SVN: r71683
2003-09-21Revert DECL_SOURCE_LOCATION -> TREE_LOCUS change.Richard Henderson1-1/+1
From-SVN: r71641
2003-09-21tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.Richard Henderson1-1/+1
* tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const. (TREE_FILENAME, TREE_LINENO): Likewise. (set_tree_locus, copy_tree_locus, set_tree_file_line): New. (TREE_LOCUS_SET_P): New. * c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c, diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c, print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c, tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c, config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Update to match. ada/ * trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and change to const. cp/ * class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c, method.c, optimize.c, pt.c, semantics.c, tree.c: Update for DECL_SOURCE_LOCATION rename and change to const. f/ * com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and change to const. java/ * class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y, resource.c: Update for DECL_SOURCE_LOCATION rename and change to const. treelang/ * treetree.c: Update for DECL_SOURCE_LOCATION rename and change to const. From-SVN: r71636
2003-09-18re PR c++/9848 (missing 'unused parameter' warning.)Nathan Sidwell1-0/+20
cp: PR c++/9848 * optimize.c (maybe_clone_body): Don't set MARK_USED on parameters here. * semantics.c (expand_body): Set it here on the remaining clones. testsuite: PR c++/9848 * g++.dg/warn/Wunused-4.C: New test. From-SVN: r71528
2003-09-17tree-optimize.c (tree_rest_of_compilation): Save and restore input_location.Richard Henderson1-3/+0
* tree-optimize.c (tree_rest_of_compilation): Save and restore input_location. * semantics.c (expand_body): Don't save/restore input_location. From-SVN: r71498
2003-09-17* semantics.c (expand_or_defer_fn): Inc/dec function_depth.Richard Henderson1-0/+4
From-SVN: r71473
2003-09-15re PR c++/3907 (nested template parm collides with member name)Mark Mitchell1-4/+0
* coverage.c (create_coverage): Do not call pushlevel/poplevel. * langhooks-def.h (lhd_do_nothing_iii_return_null_tree): New function. * langhooks.c (lhd_do_nothing_iii_return_null_tree): Define it. PR c++/3907 * class.c (maybe_note_name_used_in_class): Refine test for whether or not we are in a class scope. * cp-tree.h (language_function): Remove x_expanding_p. (expanding_p): Remove. (doing_semantic_analysis_p): Remove. (scope_kind): Add sk_function_parms, sk_class, sk_namespace. (innermost_scope_kind): New method. * call.c (cxx_type_promotes_to): Use type_decays_to. * cp-lang.c (LANG_HOOKS_PUSHLEVEL): Redefine. (LANG_HOOKS_POPLEVEL): Likewise. * decl.c (cp_binding_level): Remove parm_flag, template_parms_p, template_spec_p, namespace_p, is_for_scope, is_try_scope, and is_catch_scope. Add kind and explicit_spec_p. (cxx_scope_descriptor): Use a lookup table. (find_class_binding_level): Use "kind" field in binding_level, not the various flags. (pop_binding_level): Likewise. (innermost_nonclass_level): Likewise. (toplevel_bindings_p): Likewise. (namespace_bindings_p): Likewise. (template_parm_scope_p): Likewise. (innermost_scope_kind): New method. (current_tmpl_spec_kind): Use "kind" field in binding_level, not the various flags. (pushlevel): Remove check for doing_semantic_analysis_p. (begin_scope): Simplify. (add_decl_to_level): Use "kind" field in binding_level, not the various flags. (push_local_binding): Likewise. (pop_label): Remove check for doing_semantic_analysis_p. (poplevel): Use "kind" field in binding_level, not the various flags. (set_block): Remove check for doing_semantic_analysis_p. (pushlevel_class): Use "kind" field in binding_level, not the various flags. (poplevel_class): Likewise. (initial_push_namespace_scope): Likewise. (maybe_push_to_top_level): Likewise. (set_identifier_type_value_with_scope): Likewise. (pop_everything): Likewise. (maybe_process_template_type_declaration): Likewise. (pushtag): Likewise. (pushdecl): Likewise. (pushdecl_with_scope): Likewise. (check_previous_goto_1): Likewise. (define_label): Likewise. (finish_case_label): Likewise. (lookup_tag): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_real): Likewise. (lookup_name_current_level): Likewise. (lookup_type_current_level): Likewise. (record_builtin_type): Likewise. (cp_make_fname_decl): Likewise. (maybe_inject_for_scope_var): Likewise. (cp_finish_decl): Remove check for doing_semantic_analysis_p. (start_function): Use begin_scope, not pushlevel. (finish_function): Use "kind" field in binding_level, not the various flags. (start_method): Use begin_scope, not pushlevel. (make_label_decl): Do not check expanding_p. (save_function-data): Do not set expanding_p. (cxx_push_function_context): Do not clear expanding_p. * semantics.c (cxx_expand_function_start): Do not set expanding_p. PR c++/3907 * g++.dg/parse/template12.C: New test. * g++.dg/abi/bitfield11.C: New test. * g++.dg/abi/bitfield12.C: Likewise. From-SVN: r71393
2003-09-11cgraphunit.c (cgraph_finalize_function): Add nested arg.Richard Henderson1-1/+1
* cgraphunit.c (cgraph_finalize_function): Add nested arg. Tweek tests for function already generated. (cgraph_expand_function): Don't double announce in !unit-at-a-time. * cgraph.h (cgraph_finalize_function): Update for extra arg. * c-decl.c (finish_function): Likewise. * semantics.c (expand_or_defer_fn): Update for new cgraph_finalize_function argument. * parse.y (source_end_java_method): Update for new cgraph_finalize_function argument. From-SVN: r71298
2003-09-09cgraphunit.c (cgraph_finalize_function): Remove unused argument.Richard Henderson1-1/+1
* cgraphunit.c (cgraph_finalize_function): Remove unused argument. * cgraph.h (cgraph_finalize_function): Update. * c-decl.c (finish_function): Update. cp/ * semantics.c (expand_or_defer_fn): Update call to cgraph_finalize_function. java/ * parse.y (source_end_java_method): Update call to cgraph_finalize_function. From-SVN: r71263
2003-09-09decl2.c (finish_file): Avoid out-of-bounds array reference during memmove.Richard Henderson1-55/+5
* decl2.c (finish_file): Avoid out-of-bounds array reference during memmove. From-SVN: r71261
2003-09-08re PR c++/11786 (operator() call on variable in other namespace not recognized)Mark Mitchell1-2/+3
PR c++/11786 * decl2.c (add_function): Do not complain about seeing the same non-function twice. * semantics.c (perform_koenig_lookup): Improve documentation. PR c++/11786 * g++.dg/lookup/koenig2.C: New test. From-SVN: r71213
2003-09-08c-decl.c (c_expand_body_1): Push and pop function context here.Richard Henderson1-1/+1
gcc/ * c-decl.c (c_expand_body_1): Push and pop function context here. * tree-optimize.c (tree_rest_of_compilation): ... not here. Take nested argument instead of computing nesting ourselves. gcc/cp/ * decl.c (finish_function): Clear current_function_decl. * decl2.c (mark_used): Don't push/pop gc context. * optimize.c (optimize_function): Likewise. * tree.c (cp_cannot_inline_tree_fn): Likewise. * pt.c (instantiate_decl): Inc/dec function_depth instead. * semantics.c (expand_body): Update for tree_rest_of_compilation nested argument. From-SVN: r71208
2003-09-05re PR c++/11922 (ICE on type_unification_real)Nathan Sidwell1-5/+4
cp: PR c++/11922 * pt.c (tsubst_qualified_id): Make sure we get a non-type. (tsubst_expr, tsubst_copy_and_build): Pass false, not zero, as is_type_p to lookup_qualified_name. * semantics.c (finish_call_expr): Refactor some code. testsuite: PR c++/11922 * g++/dg/template/qualified-id1.C: New test. From-SVN: r71109
2003-09-04cp-tree.h (finish_sizeof, [...]): Remove.Nathan Sidwell1-20/+0
cp: * cp-tree.h (finish_sizeof, finish_alignof): Remove. (expr_sizeof): Replace with ... (cxx_sizeof_or_alignof_expr): ... here. (cxx_sizeof_or_alignof_type): Make complain parameter a bool. * parser.c (cp_parser_unary_expression): Commonize alignof and sizeof handling. * pt.c (tsubst_copy_and_build): Adjust alignof and sizeof substitution. * semantics.c (finish_sizeof, finish_alignof): Remove. * typeck.c (cxx_sizeof_or_alignof_type): Complain parameter becomes bool. Set TREE_READONLY. (expr_sizeof): Replace with ... (cxx_sizeof_or_alignof_expr): ... here. Clear TREE_SIDE_EFFECTS. From-SVN: r71054
2003-09-02re PR c++/11808 (Wrong namespace lookup for template function when induced ↵Mark Mitchell1-3/+10
by a template parameter) PR c++/11808 * cp-tree.h (KOENIG_LOOKUP_P): New macro. (finish_call_expr): Change prototype. * parser.c (cp_parser_postfix_expression): Adjust call to finish_call_expr. * pt.c (tsubst_copy_and_build): Use KOENIG_LOOKUP_P. * semantics.c (finish_call_expr): Add koenig_p parameter. PR c++/11808 * g++.dg/expr/call1.C: New test. From-SVN: r70998
2003-08-29tree-optimize.c: New file.Richard Henderson1-231/+19
gcc/ * tree-optimize.c: New file. * Makefile.in (OBJS-archive): Add tree-optimize.o. (tree-optimize.o): New. * c-decl.c (store_parm_decls): Use allocate_struct_function. (finish_function): Don't free_after_parsing or free_after_compilation. (set_save_expr_context): Move to tree-optimize.c. (c_expand_body_1): Use tree_rest_of_compilation. * c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New. * c-objc-common.c (expand_deferred_fns): Don't emit unused inlines; iterate until closure. * langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START, LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New. (LANG_HOOKS_RTL_EXPAND_INITIALIZER): New. * langhooks.h (struct lang_hooks_for_rtl_expansion): New. * toplev.h (tree_rest_of_compilation): Declare it. gcc/cp/ * cp-lang.c (LANG_HOOKS_RTL_EXPAND_START): New. (LANG_HOOKS_RTL_EXPAND_STMT): New. * cp-tree.h (cxx_expand_function_start): Declare. * decl.c (start_function): Use allocate_struct_function. Move stmts_are_full_exprs_p assertion from expand_body. Do not free_after_parsing or free_after_compilation. (cxx_push_function_context): Move code to set struct function data from genrtl_start_function. * optimize.c (optimize_function): Don't inc/dec function_depth. * semantics.c (expand_body): Use tree_rest_of_compilation. (cxx_expand_function_start): Rename from genrtl_start_function, omit bits done by tree_rest_of_compilation. (genrtl_finish_function): Remove. (clear_decl_rtl): Move to ../tree-optimize.c. Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r70933
2003-08-29re PR middle-end/6196 (ICE in copy_to_mode_reg, at explow.c:711)Mark Mitchell1-7/+11
PR c++/6196 * pt.c (tsubst_copy_and_build): Correct handling of address-of-label extension. * semantics.c (finish_goto_stmt): The address of a label must go through the lvalue-to-rvalue conversion. PR c++/6196 * g++.dg/ext/label1.C: New test. * g++.dg/ext/label2.C: Likewise. From-SVN: r70932
2003-08-26builtins.c (build_function_call_expr): Don't set TREE_SIDE_EFFECTS here.Nathan Sidwell1-1/+0
* builtins.c (build_function_call_expr): Don't set TREE_SIDE_EFFECTS here. * expr.c (emit_block_move_via_libcall): Likewise. (clear_storage_via_libcall): Likewise. * tree.c (build): Set TREE_SIDE_EFFECTS for non-const, non-pure CALL_EXPRs. cp: * call.c (build_call): Don't set TREE_SIDE_EFFECTS here. (build_new_method_call): Add goto finish. * semantics.c (simplify_aggr_init_exprs_r): Don't set TREE_SIDE_EFFECTS on a call. testsuite: * c++.dg/warn/noeffect3.C: New test. From-SVN: r70802
2003-08-20semantics.c (simplify_aggr_init_expr): Split out from ↵Jason Merrill1-25/+42
simplify_aggr_init_exprs_r. * semantics.c (simplify_aggr_init_expr): Split out from simplify_aggr_init_exprs_r. Convert slot address to match the return type. * cp-tree.h: Declare it. * tree.c (cp_copy_res_decl_for_inlining): Don't clobber the DECL_NAME of a user variable. From-SVN: r70635
2003-08-20re PR c++/11945 (Incorrect warnings issued for comma-expressions inside ↵Nathan Sidwell1-0/+2
templates) cp: PR c++/11945 * pt.c (build_non_dependent_expr): Look inside COND_EXPR and COMPOUND_EXPR. * semantics.c (finish_expr_stmt): Always convert to void. * typeck.c (build_x_compound_exp): Always convert to void. testsuite: PR c++/11945 * g++.dg/warn/noeffect2.C: New test. From-SVN: r70606
2003-08-18re PR c++/11957 (wrong "warning: statement has no effect")Nathan Sidwell1-6/+6
cp: PR c++/11957 * cp-tree.h (finish_stmt_expr): Add bool parameter. * init.c (finish_init_stmts): Pass true to finish_stmt_expr. Don't adjust the stmt_expr here. (build_vec_init): Use finish_stmt_expr_expr, convert result to array type. * parser.c (cp_parser_primar_expression): Adjust finish_stmt_expr call. * pt.c (tsubst_copy): Likewise. * semantics.c (finish_stmt_expr): Add parameter. testsuite: PR c++/11957 * g++.dg/warn/noeffect1.C: New test. From-SVN: r70541
2003-08-17re PR c++/11702 ([unit-at-a-time] Failure to emit code for inlined function ↵Jan Hubicka1-0/+4
in space) PR C++/11702 * semantics.c (finish_id_expression): Mark all functions as used. From-SVN: r70514
2003-08-15decl2.c (mark_member_pointers): Rename to...Jan Hubicka1-0/+2
* decl2.c (mark_member_pointers): Rename to... (mark_member_pointers_and_eh_tinfos): ... this one; deal with eh tinfos (lower_function): Update call. * except.c (eh_type_info): Break out from ... (build_eh_type): ... here; tinfo is already used. (finish_eh_spec_block): Mark tinfos as used. * semantics.c (finish_handler_params): Mark tinfo as used. * cp-tree.h(eh_type_info): Declare. From-SVN: r70477
2003-08-12re PR c++/11703 (Problem with using enum in placement delete)Mark Mitchell1-36/+0
PR c++/11703 * call.c (type_passed_as): Use TYPE_SIZE, not TYPE_PRECISION to determine whether or not to promote types. (convert_for_arg_passing): Likewise. * decl2.c (cp_build_parm_decl): Do not set DECL_ARG_TYPE in templates. * pt.c (tsubst_decl): Do not expect it to be set. PR c++/9512 PR c++/10923 * cp-tree.h (check_elaborated_type_specifier): Declare. (handle_class_head): Remove. (note_got_semicolon): Likewise. (note_list_got_semicolon): Likewise. (finish_class_definition): Likewise. * decl.c (check_elaborated_type_specifier): Make it public. Robustify. (handle_class_head): Remove. * parser.c (cp_parser_elaborated_type_specifier): Use check_elaborated_type_specifier. (cp_parser_class_specifier): Do not call finish_class_definition. (cp_parser_class_head): Or handle_class_head. Check for over-qualified names. * semantics.c (finish_class_definition): Remove. * parser.c (cp_parser_check_for_definition_in_return_type): New function. (cp_parser_simple_declaration): Adjust call to cp_parser_init_declarator. (cp_parser_decl_specifier_seq): Change type of declares_class_or_enum parameter. (cp_parser_explicit_instantiation): Adjust accordingly. (cp_parser_type_specifier): Change type of declares_class_or_enum parameter. (cp_parser_init_declarator): Add declares_class_or_enum parameter. (cp_parser_parameter_declaration): Adjust call to cp_parser_decl_specifier_seq. (cp_parser_function_definition): Likewise. (cp_parser_member_declaration): Likewise. (cp_parser_single_declaration): Likewise. * cp-tree.h (lang_type_class): Remove has_call_overloaded, has_array_ref_overloaded, has_arrow_overloaded, and got_semicolon. (TYPE_OVERLOADS_CALL_EXPR): Remove. (TYPE_OVERLOADS_ARRAY_REF): Likewise. (TYPE_OVERLOADS_ARROW): Likewise. (CLASSTYPE_GOT_SEMICOLON): Likewise. * class.c (check_bases): Do not set them. (finish_struct_1): Likewise. * decl.c (cp_finish_decl): Do not set CLASSTYPE_GOT_SEMICOLON. (build_ptrmemfunc_type): Likewise. (grok_op_properties): Do not set TYPE_OVERLOADS_*. (start_function): Do not check CLASSTYPE_GOT_SEMICOLON. * decl2.c (grokfield): Do not set CLASSTYPE_GOT_SEMICOLON. * lex.c (note_got_semicolon): Remove. (note_list_got_semicolon): Likewise. * parser.c (cp_parser_simple_declaration): Do not call note_list_got_semicolon. * pt.c (list_eq): Remove. (lookup_template_class): Do not set CLASSTYPE_GOT_SEMICOLON. (instantiate_class_template): Do not set TYPE_OVERLOADS*. (instantiate_class_template): Do not set CLASSTYPE_GOT_SEMICOLON. * ptree.c (cxx_print_type): Do not print them. * semantics.c (finish_member_class_template): Do not call note_list_got_semicolon. * g++.dg/parse/ret-type2.C: New test. PR c++/11703 * g++.dg/init/new8.C: New test. PR c++/10923 * g++.dg/parse/typedef5.C: New test. PR c++/9512 * g++.dg/parse/qualified2.C: New test. * g++.old-deja/g++.other/decl5.C: Mark one more instance of invalid code. From-SVN: r70391
2003-08-02re PR c++/9447 (using Base<T>::member does not work)Nathan Sidwell1-2/+1
cp: PR c++/9447 * cp-tree.def (USING_DECL): Document its type. * class.c (pushclass): If we're entering a template, push any dependent using decls it has. * decl2.c (do_class_using_decl): Refactor. Type is NULL iff it is a dependent scope. * pt.c (tsubst_decl) <USING_DECL case>: Set type. (tsubst): Remove USING_DECL checks. (type_dependent_expression_p): Remove USING_DECL case. * semantics.c (finish_member_declaration): A USING_DECL's type indicates whether it is dependent. testsuite: PR c++/9447 * g++.dg/template/using7.C: New test. From-SVN: r70107
2003-08-02cp-tree.h (pushclass): Remove unneeded parameter.Nathan Sidwell1-1/+1
cp: * cp-tree.h (pushclass): Remove unneeded parameter. * class.c (pushclass): Remove unneeded MODIFY parm. Adjust. (push_nested_class): Adjust pushclass call. * pt.c (instantiate_class_template): Likewise. * semantics.c (begin_class_definition): Likewise. From-SVN: r70101
2003-08-01re PR c++/11697 (Failure to diagnose class template redeclaration via using ↵Mark Mitchell1-1/+1
declaration) PR c++/11697 * decl.c (decls_match): Don't ignore the types of template classes. PR c++/11744 * pt.c (tsubst_copy_and_build): Refine Koenig lookup logic. PR c++/11697 * g++.dg/template/using6.C: New test. PR c++/11744 * g++.dg/template/koenig2.C: New test. From-SVN: r70062
2003-08-01re PR c++/11295 (ICE when using a non-trivial object in a compound statement ↵Nathan Sidwell1-30/+99
expression) PR c++/11295 * doc/extend.texi (Statement Expressions): Document C++ semantics. cp: PR c++/11295 * cp-tree.h (tubst_flags_t): Add tf_stmt_expr_cmpd, tf_stmt_expr_body. (finish_stmt_expr_expr): Declare. * parser.c (cp_parser_primary_expression): Tell cp_parser_compount_statement that it is a statement expression. (cp_parser_statement, cp_parser_labeled_statement, cp_parser_compound_statement, cp_parser_statement_seq_opt): Add in_statement_expr_p parameter. (cp_parser_expression_statement): Likewise. Call finish_stmt_expr_expr for final expression of a statement expression. (cp_parser_for_init_statement, cp_parser_implicitly_scoped_statement, cp_parser_already_scoped_statement, cp_parser_function_definition, cp_parser_try_block, cp_parser_handled): Adjust. * pt.c (tsubst_copy) <STMT_EXPR case>: Pass tf_stmt_expr. (tsubst_expr): Process tf_stmt_expr and tf_stmt_exprs flags. (tsubst_expr) <EXPR_STMT case>: Check tf_stmt_exprs flag. * semantics.c (finish_expr_stmt): Do not deal with statement expressions. (begin_stmt_expr): Clear last_expr_type. (finish_stmt_expr_expr): New. (finish_stmt_expr): Process the value expression. testsuite: PR c++/11295 * g++.dg/ext/stmtexpr1.C: New test. From-SVN: r70043
2003-08-01re PR c++/9447 (using Base<T>::member does not work)Nathan Sidwell1-1/+1
cp: PR c++/9447 * decl2.c (do_class_using_decl): Set type to NULL_TREE. * semantics.c (finish_expr_stmt): Do not convert to void in a template. testsuite: PR c++/9447 * g++.dg/template/using5.C: New test. From-SVN: r70039
2003-07-29re PR c++/9447 (using Base<T>::member does not work)Nathan Sidwell1-1/+3
cp: PR c++/9447 * decl.c (add_binding): Add bval local variable. (push_class_level_binding): Likewise. Allow a USING_DECL to be pushed. * decl2.c (do_class_using_decl): The type of a using decl is unknown. * parser.c (cp_parser_postfix_expression): Refactor unqualified-id function call lookup code. * pt.c (tsubst): A USING_DECL will have unknown type. (tsubst_copy_and_build): Allow a using decl. (type_dependent_expression_p): A USING_DECL will make it dependent. * semantics.c (finish_member_declaration): Push a dependent using declaration. testsuite: PR c++/9447 * g++.dg/template/using1.C: New test. * g++.dg/template/using2.C: New test. * g++.dg/template/using3.C: New test. * g++.dg/template/using4.C: New test. From-SVN: r69921
2003-07-29re PR c++/11530 ([unit-at-a-time] inline static function not emitted with -O3)Mark Mitchell1-19/+25
PR c++/11530 * parser.c (cp_parser_postfix_expression): Do not call mark_used. * semantics.c (finish_id_expression): Call mark_used for all declarations. PR c++/11530 * g++.dg/opt/call1.C: New test. From-SVN: r69911
2003-07-28cp-tree.h (begin_compound_stmt): No scope arg is a bool.Nathan Sidwell1-10/+8
* cp-tree.h (begin_compound_stmt): No scope arg is a bool. (finish_compound_stmt): Remove no scope arg. * decl.c (register_dtor_fn): Adjust begin_compound_stmt and end_compound_stmt calls. (expand_static_init, begin_destructor_body, begin_function_body, finish_function_body): Likewise. * decl2.c (start_objects, finish_objects, start_static_storage_duration_function, finish_static_storage_duration_function): Likewise. * init.c (begin_init_stmts, finish_init_stmts, construct_virtual_base, build_vec_init): Likewise. * method.c (do_build_assign_ref, synthesize_method): Likewise. * parser.c (cp_parser_compound_statement, cp_parser_implicitly_scoped_statement, cp_parser_already_scoped_statement): Likewise. * pt.c (tsubst_expr): Likewise. * semantics.c (begin_compound_stmt): No scope arg is a bool. (finish_compound_stmt): Remove no scope arg. * error.c (dump_expr) <COMPOUND_EXPR case>: A compound expr is always dyadic. From-SVN: r69882
2003-07-26cp-tree.h (begin_init_stmts, [...]): Remove.Nathan Sidwell1-29/+0
* cp-tree.h (begin_init_stmts, finish_init_stmts): Remove. (begin_global_stmt_expr, finish_global_stmt_expr): Remove. * init.c (begin_init_stmts): Make static. Return is_global value. Always call begin_stmt_expr. (finish_init_stmts): Make static. Add is_global parm. Always building a stmt tree. (build_aggr_init): Adjust begin_init_stmts, finish_init_stmts calls. (build_vec_init): Likewise. Always building a stmt tree. (expand_default_init): Always building a stmt tree. (get_temp_regvar): Likewise. * semantics.c (begin_global_stmt_expr, finish_global_stmt_expr): Remove. From-SVN: r69830
2003-07-25cp-tree.h (enum tsubst_flags_t): Add tf_user.Nathan Sidwell1-2/+2
* cp-tree.h (enum tsubst_flags_t): Add tf_user. * decl.c (make_typename_type): Pass it. * pt.c (lookup_template_class): Use it. (resolve_typename_type): Pass it. * semantics.c (finish_template_type): Pass it. From-SVN: r69793
2003-07-25re PR c++/11617 (g++ does not report missing member functions)Nathan Sidwell1-11/+21
cp: PR c++/11617 * cp-tree.h (qualified_name_lookup_error): Declare. * pt.c (tsubst_qualified_id): Use qualified_name_lookup_error for errors. (tsubst_expr) <DECL_STMT case>: Likewise. (tsubst_copy_and_build) <COMPONENT_REF case>: Likewise. * semantics.c (qualified_name_lookup_error): New, broken out of ... (finish_id_expression): ... here. Use it. testsuite: PR c++/11617 * g++.dg/template/lookup2.C: New test. * g++.dg/template/memclass1.C: Remove instantiated from error. From-SVN: r69790
2003-07-22fold-const.c (force_fit_type): Handle OFFSET_TYPE.Mark Mitchell1-8/+5
* fold-const.c (force_fit_type): Handle OFFSET_TYPE. * varasam.c (output_constant): Likewise. 2003-07-22 Mark Mitchell <mark@codesourcery.com> Eliminate use of POINTER_TYPE for pointers-to-members. * call.c (standard_conversion): Rework pointer-to-member handling. Add comments. (add_builtin_candidate): Likewise. (resolve_scoped_fn_name): Remove. (build_conditional_expr): Rework pointer-to-member handling. (compare_ics): Likewise. * class.c (check_field_decls): Use TYPE_PTR_P. * cp-lang.c (cp_var_mod_type_p): Rework pointer-to-member handling. * cp-tree.h (SCALAR_TYPE_P): Use TYPE_PTR_TO_MEMBER_P. (TYPE_PTRMEM_P): Add comment. (TYPE_PTR_P): Simplify. (TYPE_PTROB_P): Correct definition. (TYPE_PTR_TO_MEMBER_P): New macro. (TYPE_PTRMEM_CLASS_TYPE): Adjust. (TYPE_PTRMEM_POINTED_TO_TYPE): Likewise. (resolved_scoped_fn_name): Remove declaration. (build_offset_ref): Change prototype. (resolve_offset_ref): Remove. (comp_target_types): Remove. * cvt.c (cp_convert_to_pointer): Rework pointer-to-member handling. (convert_to_reference): Use can_convert. (ocp_convert): Improve error handling. Rework pointer-to-member handling. (perform_qualification_conversions): Rework pointer-to-member handling. * decl.c (build_ptrmem_type): Handle functions too. (create_array_type_for_decl): Remove OFFSET_TYPE error message. (grokdeclarator): Use OFFSET_TYPE for pointers to data members. (grokparms): Remove OFFSET_TYPE error message. * dump.c (cp_dump_tree): Rework pointer-to-member handling. * error.c (dump_type_prefix): Likewise. * expr.c (cplus_expand_constant): Use build_nop. * init.c (build_offset_ref): Add address_p parameter. Fold in necessary bits from resolve_offset_ref. (resolve_offset_ref): Remove. * parser.c (cp_parser_postfix_expression): Remove special case code for OFFSET_TYPE. * pt.c (convert_nontype_argument): Rework pointer-to-member handling. (convert_template_argument): Likewise. (unify): Likewise. (invalid_nontype_parm_type_p): Likewise. (dependent_type_p_r): Likewise. * rtti.c (get_tinfo_decl): Remove OFFSET_TYPE special case. (target_incomplete_p_): Rework pointer-to-member handling. (get_pseudo_ti_init): Likewise. (get_pseudo_ti_desc): Likewise. * semantics.c (finish_qualified_id_expr): Adjust call to build_offset_ref. Remove use of resolve_offset_ref. * tree.c (pod_type_p): Use TYPE_PTR_TO_MEMBER_P. * typeck.c (target_type): Use TYPE_PTRMEM_P. (type_unknown_p): Remove obsolete code about the time before non-dependent expressions were handled correctly. (qualify_type_recursive): Remove. (composite_pointer_type_r): New function. (composite_pointer_type): Use it. (merge_types): Remove dead comments. (comp_cv_target_types): Remove. (comp_target_types): Likewise. (comp_target_parms): Likewise. (cxx_sizeof_or_alignof_type): Remove OFFSET_TYPE error. (build_indirect_ref): Use TYPE_PTR_TO_MEMBER_P. (build_binary_op): Do not use of comp_target_types. (pointer_diff): Remove OFFSET_TYPE case. (build_unary_op): Adjust pointer-to-member handling. (unary_complex_lvalue): Likewise. (check_for_casting_away_constness): Add description parameter. (build_static_cast): Pass it. (build_reinterpret_cast): Use check_for_casting_away_constness. (build_const_cast): Adjust pointer-to-member handling. (build_c_cast): Likewise. (convert_for_assignment): Remove OFFSET_TYPE error message. (comp_ptr_ttypes_real): Adjust pointer-to-member handling. (comp_ptr_ttypes_reinterpret): Remove. (casts_away_constness_r): Adjust pointer-to-member handling. (casts_away_constness): Liekwise. (strip_all_pointer_quals): Remove. * typeck2.c (digest_init): Adjust pointer-to-member handling. (build_m_component_ref): Likewise. From-SVN: r69691
2003-07-21cp-tree.h (hack_identifier): Remove.Nathan Sidwell1-6/+75
cp: * cp-tree.h (hack_identifier): Remove. * method.c (hack_identifier): Remove. * semantics.c (finish_id_expression): Expand hack_identifier here. Simplify. From-SVN: r69625
2003-07-19fixfixes.c [...]: Remove unnecessary casts.Kaveh R. Ghazi1-1/+1
gcc: * fixinc/fixfixes.c fixinc/fixincl.c fixinc/fixlib.c fixinc/server.c objc/objc-act.c: Remove unnecessary casts. f: * com.c data.c expr.c fini.c g77spec.c global.c lab.c lex.c name.c sta.c stc.c std.c storag.c stt.c stw.c symbol.c target.c type.c: Remove unnecessary casts. cp: * call.c class.c decl.c decl2.c g++spec.c lex.c parser.c pt.c rtti.c semantics.c typeck.c: Remove unnecessary casts. java: * class.c java-tree.h jcf-write.c jvspec.c: Remove unnecessary casts. treelang: * treetree.c: Remove unnecessary casts. From-SVN: r69593
2003-07-18cp-tree.h (finish_non_static_data_member): Add object param.Nathan Sidwell1-17/+33
cp: * cp-tree.h (finish_non_static_data_member): Add object param. * method.c (hack_identifier): Adjust. * pt.c (tsubst_copy_and_build) <COMPONENT_REF case>: Don't search again for a FIELD_DECL. * semantics.c (finish_non_static_data_member): Add object parameter. Always save the DECL in the COMPONENT_REF. * call.c (resolve_scoped_fn_name): Adjust. testsuite: * g++.dg/parse/non-dependent2.C: New test. From-SVN: r69564
2003-07-17re PR c++/11547 (ICE with const temporaries)Mark Mitchell1-8/+2
PR c++/11547 * cp-tree.h (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P): New macro. (DECL_PRETTY_FUNCTION_P): Use VAR_DECL_CHECK. * decl.c (duplicate_decls): Merge DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. * parser.c (cp_parser_postfix_expression): Adjust call to cp_parser_initializer_list and cp_parser_parenthesized_expression_list. (cp_parser_parenthesized_expression_list): Add non_constant_p. (cp_parser_new_placement): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_direct_new_declarator): Likewise. (cp_parser_conditional_expression): Remove. (cp_parser_constant_expression): Parse an assignment-expression, not a conditional-expression. (cp_parser_simple_declaration): Resolve expression/declaration ambiguity more quickly. (cp_parser_mem_initializer): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_init_declarator): Keep track of whether or not the initializer is a constant-expression. (cp_parser_initializer): Add non_constant_p parameter. (cp_parser_initializer_clause): Likewise. (cp_parser_initializer_list): Likewise. (cp_parser_attribute_list): Adjust call to cp_parser_parenthesized_expression_list. (cp_parser_functional_cast): Likewise. * pt.c (tsubst_decl): Copy DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. (tsubst_expr): Tweak use of DECL_PRETTY_FUNCTION_P. * semantics.c (finish_id_expression): Use DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P. PR c++/11547 * g++.dg/parse/constant3.C: New test. * g++.dg/parse/crash7.C: Likewise. From-SVN: r69493
2003-07-16cp-tree.def (LOOKUP_EXPR): Remove.Mark Mitchell1-10/+4
* cp-tree.def (LOOKUP_EXPR): Remove. * cp-tree.h (cp_id_kind): Add CP_ID_KIND_UNQUALIFIED_DEPENDENT. (LOOKUP_EXPR_GLOBAL): Remove. (get_bindings): Remove. (is_aggr_type_2): Remove. * call.c (resolved_scoped_fn_name): Remove support for LOOKUP_EXPR. * decl.c (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (dump_decl): Likewise. (dump_expr): Likewise. * friend.c (do_friend): Likewise. * init.c (build_offset_ref): Likewise. * lex.c (unqualified_fn_lookup_error): Use pedwarn. Do not create LOOKUP_EXPRs * mangle.c (write_expression): Remove support for LOOKUP_EXPR. * parser.c (cp_parser_postfix_expression): Modify Koenig lookup test. * pt.c (get_bindings): Give it internal linkage. (check_explicit_specialization): Remove support for LOOKUP_EXPR. (lookup_template_function): Likewise. (for_each_tempalte_parm_r): Likewise. (tsubst_decl): Likewise. (tsubst_qualified_id): Handle template template parameters. (tsubst_copy): Remove support for LOOKUP_EXPR. (tsubst_copy_and_build): Likewise. (most_general_template): Likewise. (value_dependent_expression_p): Likewise. (type_dependent_expression_p): Note that IDENTIFIER_NODEs are always dependent. * semantics.c (perform_koenig_lookup): Do not create IDENTIFIER_NODEs. (finish_fname): Likewise. (finish_id_expression): Likewise. * tree.c (is_aggr_type_2): Remove. From-SVN: r69427
2003-07-14re PR c++/7019 ([3.3 only] SFINAE does not work with explicitally specified ↵Mark Mitchell1-0/+3
template arguments) PR c++/7019 * cp-tree.h (lookup_qualified_name): Adjust prototype. * decl.c (lookup_qualified_name): Add complain parameter. Adjust call to is_aggr_type. * parser.c (cp_parser_lookup_name): Adjust call to lookup_qualified_name. * pt.c (tsubst_qualified_id): Likewise. (tsubst_copy_and_build): Likewise. * semantics.c (finish_qualified_id_expr): Deal with erroneous expressions. PR c++/7019 * g++.dg/template/overload2.C: New test. From-SVN: r69342