aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
AgeCommit message (Collapse)AuthorFilesLines
2007-09-28re PR c++/10179 (alignment attributes are not inherited correctly with empty ↵Jason Merrill1-3/+13
classes) PR c++/10179 * class.c (layout_empty_base): Take rli parameter, update rli->record_align if empty base has user-specified alignment. (build_base_field): Pass rli to it. From-SVN: r128871
2007-09-20re PR c++/7586 (Incorrect handling of attributes in template codes)Jason Merrill1-10/+2
PR c++/7586 * pt.c (tsubst): Handle typedefs by looking for the specialization. (retrieve_specialization): Only tagged types use DECL_TEMPLATE_INSTANTIATIONS. (instantiate_class_template): Push nested classes too. (tsubst_decl) [TYPE_DECL]: Only check for canonical decl for tagged types. * cp-tree.h (MAYBE_TAGGED_TYPE_P): New macro. * init.c (is_aggr_type): Remove redundant tests. * class.c (push_nested_class): Use CLASS_TYPE_P. From-SVN: r128621
2007-09-05re PR c++/30302 (ICE with invalid member in anonymous struct)Paolo Carlini1-4/+19
/cp 2007-09-03 Paolo Carlini <pcarlini@suse.de> PR c++/30302 * semantics.c (finish_id_expression): Check that path != NULL_TREE before using TYPE_BINFO on it. * class.c (finish_struct_anon): Deal correctly with anonymous structs (vs unions, as GNU extension) in error messages. /testsuite 2007-09-03 Paolo Carlini <pcarlini@suse.de> PR c++/30302 * g++.dg/ext/anon-struct5.C: New. From-SVN: r128145
2007-08-25c-common.c (vector_types_convertible_p, [...]): Constify.Kaveh R. Ghazi1-1/+1
* c-common.c (vector_types_convertible_p, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p): Constify. * c-common.h (has_c_linkage, decl_with_nonnull_addr_p, c_promoting_integer_type_p, self_promoting_args_p, anon_aggr_type_p, vector_types_convertible_p): Likewise. * c-decl.c (anon_aggr_type_p): Likewise. * * c-dump.c (dump_stmt): Likewise. * c-objc-common.c (has_c_linkage): Likewise. * c-tree.h (same_translation_unit_p): Likewise. * c-typeck.c (null_pointer_constant_p, tagged_types_tu_compatible_p, function_types_compatible_p, type_lists_compatible_p, lvalue_or_else, lvalue_p, comptypes_internal, struct tagged_tu_seen_cache, same_translation_unit_p, alloc_tagged_tu_seen_cache, c_size_in_bytes): Likewise. * ggc-common.c (compare_ptr_data, hash_descriptor, eq_descriptor, hash_ptr, eq_ptr): Likewise. * langhooks-def.h (lhd_decl_ok_for_sibcall, LANG_HOOKS_OMP_PRIVATIZE_BY_REFERENCE): Likewise. * langhooks.c (lhd_decl_ok_for_sibcall): Likewise. * langhooks.h (ok_for_sibcall, omp_privatize_by_reference): Likewise. * optabs.c (optab_for_tree_code): Likewise. * optabs.h (optab_for_tree_code): Likewise. * rtl.h (simplify_rtx): Likewise. * simplify-rtx.c (simplify_rtx): Likewise. * tree-dump.c (queue, queue_and_dump_index, queue_and_dump_type, dump_flag, dump_node): Likewise. * tree-dump.h (struct dump_info, dump_stmt, queue_and_dump_index, queue_and_dump_type, dump_flag): Likewise. * tree-flow.h (vect_can_force_dr_alignment_p): Likewise. * tree-pass.h (dump_node): Likewise. * tree-vectorizer.c (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vectorizer.h (vect_can_force_dr_alignment_p, supportable_narrowing_operation): Likewise. * tree-vrp.c (needs_overflow_infinity, supports_overflow_infinity, is_negative_overflow_infinity, is_positive_overflow_infinity, is_overflow_infinity, vrp_val_is_max, vrp_val_is_min, nonnull_arg_p, get_value_range, vrp_operand_equal_p, update_value_range, add_equivalence, ssa_name_nonnegative_p, ssa_name_nonzero_p, fp_predicate): Likewise. * tree.c (auto_var_in_fn_p, empty_body_p): Likewise. * tree.h (empty_body_p, auto_var_in_fn_p, ssa_name_nonzero_p, ssa_name_nonnegative_p): Likewise. cp: * call.c (sufficient_parms_p): Constify. * class.c (same_signature_p): Likewise. * cp-gimplify.c (is_invisiref_parm, cxx_omp_privatize_by_reference): Likewise. * cp-objcp-common.c (has_c_linkage): Likewise. * cp-tree.h (NON_THUNK_FUNCTION_CHECK, THUNK_FUNCTION_CHECK, sufficient_parms_p, same_signature_p, copy_fn_p, move_fn_p, grok_ctor_properties, nothrow_libfn_p, skip_artificial_parms_for, num_artificial_parms_for, comp_template_parms, template_parameter_pack_p, any_dependent_template_arguments_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, repo_export_class_p, cxx_omp_privatize_by_reference, pod_type_p, zero_init_p, member_p, cp_lvalue_kind, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, is_dummy_object, special_function_kind, string_conv_p, type_unknown_p, comp_except_specs, compparms, comp_cv_qualification, is_bitfield_expr_with_lowered_type, unlowered_expr_type, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, at_least_as_qualified_p, invalid_nonstatic_memfn_p, lvalue_or_else, lvalue_p): Likewise. * decl.c (copy_fn_p, move_fn_p, grok_ctor_properties): Likewise. * except.c (nothrow_libfn_p): Likewise. * method.c (skip_artificial_parms_for, num_artificial_parms_for): Likewise. * pt.c (comp_template_parms, template_parameter_pack_p, any_type_dependent_arguments_p, any_value_dependent_elements_p, any_dependent_template_arguments_p): Likewise. * repo.c (repo_export_class_p): Likewise. * semantics.c (anon_aggr_type_p): Likewise. * tree.c (lvalue_p_1, real_lvalue_p, lvalue_p, builtin_valid_in_constant_expr_p, decl_anon_ns_mem_p, varargs_function_p, member_p, is_dummy_object, pod_type_p, zero_init_p, special_function_p): Likewise. * typeck.c (comp_array_types, type_unknown_p, comp_except_specs, comp_array_types, at_least_as_qualified_p, comp_cv_qualification, compparms, invalid_nonstatic_memfn_p, is_bitfield_expr_with_lowered_type, unlowered_expr_type, string_conv_p, ptr_reasonably_similar, cp_type_readonly, cp_has_mutable_p, lvalue_or_else): Likewise. fortran: * trans-openmp.c (gfc_omp_privatize_by_reference): Constify. * trans.h (gfc_omp_privatize_by_reference): Likewise. java: * lang.c (java_decl_ok_for_sibcall): Likewise. From-SVN: r127799
2007-08-20re PR c++/7302 (-Wnon-virtual-dtor should't complain of protected dtor)Pawel Sikora1-7/+9
PR c++/7302 * cp/class.c (finish_struct_1): Warn when a class has virtual functions and accessible non-virtual destructor. * doc/invoke.texi (-Wnon-virtual-dtor): Update documentation. * g++.dg/warn/Wnvdtor-2.C: New testcase. From-SVN: r127649
2007-08-02typeck.c: Change copyright header to refer to version 3 of the GNU General ↵Nick Clifton1-4/+3
Public... * typeck.c: Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page. * optimize.c, lang-specs.h, init.c, class.c, repo.c, decl.c, config-lang.in, cp-tree.def, call.c, decl.h, ptree.c, Make-lang.in, method.c, rtti.c, cp-objcp-common.c, g++spec.c, cp-objcp-common.h, except.c, error.c, operators.def, cvt.c, tree.c, mangle.c, cp-tree.h, dump.c, search.c, friend.c, expr.c, cp-gimplify.c, cxx-pretty-print.c, cp-lang.c, typeck2.c, pt.c, cxx-pretty-print.h, semantics.c, name-lookup.c, lex.c, decl2.c, name-lookup.h, parser.c: Likewise. From-SVN: r127154
2007-07-03re PR c++/32609 (ICE in htab_clear_slot at libiberty/hashtab.c:722)Richard Guenther1-1/+1
2007-07-03 Richard Guenther <rguenther@suse.de> PR c++/32609 * class.c (fixed_type_or_null): Re-lookup the hashtable slot after recursing. From-SVN: r126262
2007-06-15[multiple changes]Andrew Pinski1-7/+13
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> Zdenek Dvorak <dvorakz@suse.cz> Richard Guenther <rguenther@suse.de> Kaz Kojima <kkojima@gcc.gnu.org> * tree-vrp.c (compare_values_warnv): Convert val2 to the type of val1. (extract_range_from_assert): Create POINTER_PLUS_EXPR for pointer types. (extract_range_from_binary_expr): Handle only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR for pointer types. * doc/c-tree.texi (POINTER_PLUS_EXPR): Document. * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (number_of_iterations_lt_to_ne): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (assert_loop_rolls_lt): For pointer types, use sizetype when creating MINUS_EXPR/PLUS_EXPRs. (number_of_iterations_le): Likewise. (expand_simple_operations): POINTER_PLUS_EXPR are simple also. (derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just like PLUS_EXPR and MINUS_EXPR. * tree-pretty-print.c (dump_generic_node): Handle POINTER_PLUS_EXPR. (op_prio): Likewise. (op_symbol_1): Likewise. * optabs.c (optab_for_tree_code): Likewise. * tree-ssa-loop-manip.c (create_iv): Handle pointer base specially. * tree-tailcall.c (process_assignment): Mention POINTER_PLUS_EXPR in a TODO comment. * tree.c (build2_stat): Assert when trying to use PLUS_EXPR or MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR not used with a pointer and an integer type. * tree-scalar-evolution.c (add_to_evolution_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. (follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like PLUS_EXPR except for the right hand side's type will be sizetype. (interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR. (fold_used_pointer_cast): Kill. (pointer_offset_p): Kill. (fold_used_pointer): Kill. (pointer_used_p): Kill. (analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't call fold_used_pointer. (instantiate_parameters_1): Convert the increment using chrec_convert_rhs instead of chrec_convert. Handle POINTER_PLUS_EXPR as PLUS_EXPR. * builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (std_gimplify_va_arg_expr): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. (std_expand_builtin_va_start): Use sizetype for the call to make_tree and then convert to the pointer type. (fold_builtin_memchr): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for adding to a pointer. (std_gimplify_va_arg_expr): Use fold_build2 for the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast the operands to sizetype first and then cast the BIT_AND_EXPR back to the pointer type. * fold-const.c (build_range_check): Handle pointer types specially. (extract_array_ref): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Make sure the offset is converted to sizetype. (try_move_mult_to_index): Strip the NOPs from the offset. Remove code argument and replace all uses with PLUS_EXPR. (fold_to_nonsharp_ineq_using_bound): Handle pointer types specially. Don't use a pointer type for MINUS_EXPR. (fold_unary): Handle for (T1)(X op Y), only p+ as that is the only as that can be handled for binary operators now. (fold_binary <case POINTER_PLUS_EXPR>): Add folding of POINTER_PLUS_EXPR. <case PLUS_EXPR>: Add folding of PTR+INT into PTR p+ INT. Don't call try_move_mult_to_index. <case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B) into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into (PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies. Don't call try_move_mult_to_index. (tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR. (tree_expr_nonzero_p): Likewise. (fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead of PLUS_EXPR for the complex expression folding. * tree-chrec.c (chrec_fold_plus_poly_poly): If the first chrec is a pointer type, then the second should be sizetype and not the first's type. For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR instead of PLUS_EXPR. When either operand is zero, convert the other operand. (chrec_apply): Use chrec_convert_rhs on the argument x instead of chrec_convert. (reset_evolution_in_loop): For pointer types, the new_evol should be sizetype. (convert_affine_scev): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. (chrec_convert_rhs): New function. (chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a different right hand side type. Handle POINTER_PLUS_EXPR like PLUS_EXPR. * tree-chrec.h (chrec_convert_rhs): New prototype. (build_polynomial_chrec): For pointer types, the right hand * tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for POINTER_PLUS_EXPR instead of PLUS_EXPR's. Remove subtraction case as it is always addition now. Make sure the offset is converted to sizetype. (fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially. Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before. * tree-ssa-loop-ivopts.c (determine_base_object): Abort for PLUS_EXPR in pointer type. Handle POINTER_PLUS_EXPR. (tree_to_aff_combination): Likewise. (force_expr_to_var_cost): Likewise. (force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR of pointer types. * tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (check_va_list_escapes): Likewise. (check_all_va_list_escapes): Likewise. * dwarf2out.c (loc_descriptor_from_tree_1): Handle POINT_PLUS_EXPR as a PLUS_EXPR. * expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR. (string_constant): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): When adding the offset to the base, use POINTER_PLUS_EXPR. (add_to_parts): Convert the index to sizetype. (create_mem_ref): Create A POINTER_PLUS_EXPR for the one case. * matrix-reorg.c (collect_data_for_malloc_call): Stmt will now only be either INDIRECT_REF and POINTER_PLUS_EXPR. Offset only holds something for PLUS_EXPR. (ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as a PLUS_EXPR. (analyze_transpose): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. (analyze_accesses_for_modify_stmt): Likewise. Remove comment about the type being integral type as it is wrong now. (can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as PLUS_EXPR. (transform_access_sites): POINTER_PLUS_EXPR will only show up now and not PLUS_EXPR. Correct the type which the artimentic is done in (is now sizetype). Reindent one loop. * tree-data-ref.c (split_constant_offset): Handle POINTER_PLUS_EXPR * tree-affine.c (tree_to_aff_combination): Likewise. * c-typeck.c (build_unary_op): For pointers create the increment as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * gimplify.c (gimplify_self_mod_expr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR. * tree.def (POINTER_PLUS_EXPR): New tree code. * tree-predcom.c (ref_at_iteration): If we have a pointer type do the multiplication in sizetype. * tree-mudflap.c (mf_xform_derefs_1): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-forwprop.c (forward_propagate_addr_into_variable_array_index): Don't expect there to be a cast for the index as that does not exist anymore. (forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR instead of PLUS_EXPR. Don't check for the first operand of the POINTER_PLUS_EXPR was the index as it cannot be. Call forward_propagate_addr_into_variable_array_index with the SSA_NAME instead of the statement. * varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR. (compare_constant): Likewise. (copy_constant): Likewise. (compute_reloc_for_constant): Likewise. (output_addressed_constants): Likewise. (initializer_constant_valid_p): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion_1): Convert the MIN/MAX of the inner type to the outer type before comparing them. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-inline.c (estimate_num_insns_1): Handle POINTER_PLUS_EXPR. * tree-vect-transform.c (vect_create_addr_base_for_vector_ref): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (bump_vector_ptr): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for the pointer increment statement. (vect_update_ivs_after_vectorizer): For pointer types, create POINTER_PLUS_EXPR instead of PLUS_EXPR and also create MULT_EXPR in sizetype. (vect_gen_niters_for_prolog_loop): Add a cast when creating byte_misalign. * tree-object-size.c (plus_expr_object_size): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. (check_for_plus_in_loops_1): Likewise. (check_for_plus_in_loops): Likewise. * c-common.c (pointer_int_sum): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * tree-ssa-structalias.c (handle_ptr_arith): Handle only POINTER_PLUS_EXPR. Removing all the extra code which is trying to figure out which side is a pointer and is the index. * tree-cfg.c (verify_expr): Add extra checking for pointers and PLUS_EXPR and MINUS_EXPR. Also add checking to make sure the operands of POINTER_PLUS_EXPR are correct. * config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype with make_tree, instead of a pointer type. * config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR for pointers instead of PLUS_EXPR. (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR instead of PLUS_EXPR when doing addition on pointer types. Use sizetype for the second operand. (spu_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was a pointer. Don't create a BIT_AND_EXPR for pointer types. * config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR for the pointer addition and also use size_int/sizetype for the offset. (ix86_gimplify_va_arg): Likewise. Perform BIT_AND_EXPR on sizetype arguments. * config/sh/sh.c (sh_va_start): Call make_tree with sizetype and convert its result to a pointer type. Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. (sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer additions and also use size_int for the offsets. Perform BIT_AND_EXPR on sizetype arguments. * config/ia64/ia64.c (ia64_gimplify_va_arg): Use POINTER_PLUS_EXPR for pointers and create the BIT_AND_EXPR in sizetype. * config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. (rs6000_va_start): Likewise. Also use sizetype for the offset. * config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR as PLUS_EXPR/MINUS_EXPR. (hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR. Don't use BIT_AND_EXPR on a pointer type, convert the expression to sizetype first. * config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR for pointers. (mips_gimplify_va_arg_expr): Likewise. Don't create BIT_AND_EXPR in a pointer type. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition. * trans-expr.c (gfc_trans_string_copy): Create POINTER_PLUS_EXPR instead of a PLUS_EXPR for pointer types. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * typeck.c (build_binary_op): For templates build the expression in pieces to avoid the assert in build2_stat. (get_member_function_from_ptrfunc): Change over to using POINTER_PLUS_EXPR and convert the second operand to sizetype. * typeck2.c (build_m_component_ref): Likewise. * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * class.c (build_base_path): Likewise. (build_base_path): Likewise. (convert_to_base_statically): Likewise. (fixed_type_or_null): Handle POINTER_PLUS_EXPR. (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR instead of PLUS_EXPR. (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * call.c (build_special_member_call): Likewise. * rtti.c (build_headof): Likewise. Use sizetype instead of ptrdiff_type_node. (tinfo_base_init): Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers. * except.c (expand_start_catch_block): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert PLUS_EXPR on pointer types over to use POINTER_PLUS_EXPR and remove the conversion to the pointer types. * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for adding to a pointer type. Use size_int instead of ssize_int. Convert the index to sizetype before adding it to the pointer. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * trans.c (Attribute_to_gnu): When subtracting an offset from a pointer, use POINTER_PLUS_EXPR with NEGATE_EXPR instead of MINUS_EXPR. (gnat_to_gnu): Likewise. * utils.c (convert): When converting between thin pointers, use POINTER_PLUS_EXPR and sizetype for the offset. * utils2.c (known_alignment): POINTER_PLUS_EXPR have the same semantics as PLUS_EXPR for alignment. (build_binary_op): Add support for the semantics of POINTER_PLUS_EXPR's operands. When adding an offset to a pointer, use POINTER_PLUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> * class.c (make_class_data): Build the index in sizetype. Use POINTER_PLUS_EXPR instead of PLUS_EXPR when adding to a pointer type. (build_symbol_entry): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. * except.c (build_exception_object_ref): Do a NEGATIVE and then a POINTER_PLUS_EXPR instead of a MINUS_EXPR. 2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/32225 * gcc.c-torture/compile/20070605-1.c: New test. * gcc.c-torture/compile/20070603-1.c: New testcase. * gcc.c-torture/compile/20070603-2.c: New testcase. * gcc.c-torture/compile/20070531-1.c: New test. PR tree-opt/32167 * gcc.c-torture/compile/20070531-2.c: New test. PR tree-opt/32144 * gcc.c-torture/compile/20070529-1.c: New test. PR tree-opt/32145 * gcc.c-torture/compile/20070529-2.c: New test. PR tree-opt/32015 * gcc.c-torture/compile/20070520-1.c: New test. * g++.dg/ext/java-1.C: New test. * gcc.dg/vect/vect-106.c: We are now able to vectorize two loops instead of one. Remove the "can't determine dependence" check. * gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer needed as the cast is gone in the first place. * gcc.dg/max-1.c: Change local variable a to be a global one. * gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't have a cast which is PREd. From-SVN: r125755
2007-06-15cp-tree.h (DECL_VAR_MARKED_P): Remove.Mark Mitchell1-17/+30
* cp-tree.h (DECL_VAR_MARKED_P): Remove. (DECL_ANON_UNION_VAR_P): New macro. * class.c (fixed_type_or_null): Tidy. Use a hash table, rather than DECL_VAR_MARKED_P, to keep track of which variables we have seen. * decl.c (redeclaration_error_message): Complain about redeclaring anonymous union members at namespace scope. * decl2.c (build_anon_union_vars): Set DECL_ANON_UNION_VAR_P. * g++.dg/lookup/anon6.C: New test. From-SVN: r125745
2007-04-11class.c (convert_to_base_statically): Fold produced tree; verify that we are ↵Jan Hubicka1-4/+10
not processing template_decl. * cp/class.c (convert_to_base_statically): Fold produced tree; verify that we are not processing template_decl. From-SVN: r123711
2007-04-09re PR c++/31449 ([4.1] static_cast can remove const-ness)Mark Mitchell1-1/+12
PR c++/31449 * class.c (build_base_path): Ensure that the converted pointer has the same cv-qualification as the input. PR c++/31449 * g++.dg/init/const5.C: New test. From-SVN: r123679
2007-04-04winnt-cxx.c (i386_pe_type_dllimport_p): Don't ignore dllimport attribute of ↵Danny Smith1-10/+0
virtual methods. gcc * config/i386/winnt-cxx.c (i386_pe_type_dllimport_p): Don't ignore dllimport attribute of virtual methods. gcc/cp * class.c (check_for_override): Don't remove dllmport attribute of virtual methods. gcc/testsuite * g++.dg/ext/dllimport12.C: Update comments From-SVN: r123492
2007-03-30re PR c++/26099 (support for type traits is not available)Paolo Carlini1-0/+4
gcc/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * c-common.h (enum rid): Add RID_HAS_NOTHROW_ASSIGN, RID_HAS_NOTHROW_CONSTRUCTOR, RID_HAS_NOTHROW_COPY, RID_HAS_TRIVIAL_ASSIGN, RID_HAS_TRIVIAL_CONSTRUCTOR, RID_HAS_TRIVIAL_COPY, RID_HAS_TRIVIAL_DESTRUCTOR, RID_HAS_VIRTUAL_DESTRUCTOR, RID_IS_ABSTRACT, RID_IS_BASE_OF, RID_IS_CONVERTIBLE_TO, RID_IS_CLASS, RID_IS_EMPTY, RID_IS_ENUM, RID_IS_POD, RID_IS_POLYMORPHIC, RID_IS_UNION, as C++ extensions. * doc/extend.texi (Extensions to the C++ Language): Add Type Traits. gcc/cp/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * cp-tree.h (enum cp_trait_kind, struct tree_trait_expr, TRAIT_EXPR_TYPE1, TRAIT_EXPR_TYPE2, TRAIT_EXPR_KIND): Add. (enum cp_tree_node_structure_enum, union lang_tree_node): Update. (CLASS_TYPE_NON_UNION_P): Add. (struct lang_type_class): Add has_complex_dflt. (TYPE_HAS_COMPLEX_DFLT, TYPE_HAS_TRIVIAL_DFLT): Add. (locate_copy, locate_ctor, locate_dtor, finish_trait_expr): Declare. * cp-tree.def: Add TRAIT_EXPR. * cp-objcp-common.c (cp_tree_size): Add TRAIT_EXPR case. * lex.c (struct resword): Add __has_nothrow_assign, __has_nothrow_constructor, __has_nothrow_copy, __has_trivial_assign, __has_trivial_constructor, __has_trivial_copy, __has_trivial_destructor, __has_virtual_destructor, __is_abstract, __is_base_of, __is_class, __is_convertible_to, __is_empty, __is_enum, __is_pod, __is_polymorphic, __is_union. * parser.c (cp_parser_primary_expression): Deal with the new RIDs. (cp_parser_trait_expr): New. * semantics.c (finish_trait_expr, trait_expr_value classtype_has_nothrow_copy_or_assign_p): New. * method.c (locate_copy, locate_ctor, locate_dtor): Do not define as static. * decl.c (cp_tree_node_structure): Add TRAIT_EXPR. * class.c (check_bases, check_field_decl, check_bases_and_members): Deal with TYPE_HAS_COMPLEX_DFLT (t) too. * pt.c (uses_template_parms, tsubst_copy_and_build, value_dependent_expression_p, type_dependent_expression_p): Deal with TRAIT_EXPR. * tree.c (cp_walk_subtrees): Deal with TRAIT_EXPR. gcc/testsuite/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * g++.dg/ext/is_base_of.C: New. * g++.dg/ext/has_virtual_destructor.C: New. * g++.dg/ext/is_polymorphic.C: New. * g++.dg/ext/is_base_of_diagnostic.C: New. * g++.dg/ext/is_enum.C: New. * g++.dg/ext/has_nothrow_assign.C: New. * g++.dg/ext/has_nothrow_constructor.C: New. * g++.dg/ext/is_empty.C: New. * g++.dg/ext/has_trivial_copy.C: New. * g++.dg/ext/has_trivial_assign.C: New. * g++.dg/ext/is_abstract.C: New. * g++.dg/ext/is_pod.C: New. * g++.dg/ext/has_nothrow_copy.C: New. * g++.dg/ext/is_class.C: New. * g++.dg/ext/has_trivial_constructor.C: New. * g++.dg/ext/is_union.C: New. * g++.dg/ext/has_trivial_destructor.C: New. * g++.dg/tree-ssa/pr22444.C: Adjust, avoid __is_pod. * g++.dg/template/crash43.C: Likewise. libstdc++-v3/ 2007-03-30 Paolo Carlini <pcarlini@suse.de> PR c++/26099 * include/bits/cpp_type_traits.h (struct __is_pod, struct __is_empty): Remove. * include/bits/valarray_array.h: Adjust. * include/bits/allocator.h: Likewise. * include/bits/stl_tree.h: Likewise. From-SVN: r123366
2007-03-14class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning.Manuel López-Ibáñez1-2/+2
2007-03-14 Manuel Lopez-Ibanez <manu@gcc.gnu.org> cp/ * class.c (warn_hidden): Add OPT_Woverloaded_virtual to warning. From-SVN: r122926
2007-03-02re PR c++/28253 (ICE with invalid covariant return)Simon Martin1-1/+2
2007-03-02 Simon Martin <simartin@users.sourceforge.net> PR c++/28253 * class.c (update_vtable_entry_for_fn): Properly handle invalid overriders for thunks. From-SVN: r122490
2007-02-23class.c (note_name_declared_in_class): Make declaration changes meaning a ↵Richard Guenther1-3/+3
pedwarn. 2007-02-23 Richard Guenther <rguenther@suse.de> * class.c (note_name_declared_in_class): Make declaration changes meaning a pedwarn. * g++.dg/warn/changes-meaning.C: New testcase. From-SVN: r122255
2007-02-04class.c, [...]: Follow spelling conventions.Kazu Hirata1-5/+5
* class.c, cp-tree.h, decl.c, decl2.c, g++spec.c, init.c, parser.c, pt.c, tree.c, typeck.c: Follow spelling conventions. From-SVN: r121566
2007-01-17vec.h (VEC_reserve_exact): Define.Ian Lance Taylor1-1/+7
./: * vec.h (VEC_reserve_exact): Define. (vec_gc_p_reserve_exact): Declare. (vec_gc_o_reserve_exact): Declare. (vec_heap_p_reserve_exact): Declare. (vec_heap_o_reserve_exact): Declare. (VEC_OP (T,A,reserve_exact)): New static inline function, three versions. (VEC_OP (T,A,reserve)) [all versions]: Remove handling of negative parameter. (VEC_OP (T,A,alloc)) [all versions]: Call ...reserve_exact. (VEC_OP (T,A,copy)) [all versions]: Likewise. (VEC_OP (T,a,safe_grow)) [all versions]: Likewise. * vec.c (calculate_allocation): Add exact parameter. Change all callers. (vec_gc_o_reserve_1): New static function, from vec_gc_o_reserve. (vec_gc_p_reserve, vec_gc_o_reserve): Call vec_gc_o_reserve_1. (vec_gc_p_reserve_exact, vec_gc_o_reserve_exact): New functions. (vec_heap_o_reserve_1): New static function, from vec_heap_o_reserve. (vec_heap_p_reserve, vec_heap_o_reserve): Call vec_heap_o_reserve_1. (vec_heap_p_reserve_exact): New function. (vec_heap_o_reserve_exact): New function. cp/: * class.c (add_method): Call VEC_reserve_exact rather than passing a negative size to VEC_reserve. From-SVN: r120861
2007-01-06re PR c++/19439 (Duplicate destructor accepted)Lee Millward1-78/+71
PR c++/19439 * class.c (add_method): Don't wait until template instantiation time to complain about duplicate methods. * g++.dg/template/duplicate1.C: New test * g++.dg/template/memfriend6.C: Adjust error markers. From-SVN: r120520
2006-11-28class.c (build_vcall_offset_vtbl_entries): Do not add vcall entries for a ↵Mark Mitchell1-1/+8
primary construction virtual table. * class.c (build_vcall_offset_vtbl_entries): Do not add vcall entries for a primary construction virtual table. From-SVN: r119271
2006-11-20re PR c++/29475 (incomplete template diagnostics.)Simon Martin1-2/+2
PR c++/29475 * cp-tree.h (enforce_access, perform_or_defer_access_check): Added an extra argument that represents the declaration to use to print potential error messages. * init.c (build_offset_ref): Adjusted the call to perform_or_defer_access_check. * class.c (alter_access, resolve_address_of_overloaded_function): Likewise. * decl.c (make_typename_type, make_unbound_class_template): Likewise. * search.c (lookup_member): Likewise. * friend.c (add_friend): Likewise. * parser.c (cp_parser_template_id, cp_parser_pre_parsed_nested_name_specifier): Likewise. * semantics.c (finish_non_static_data_member, check_accessibility_of_qualified_id, finish_id_expression): Likewise. (pop_to_parent_deferring_access_checks, perform_access_checks, perform_or_defer_access_check): Adjusted the call to enforce_access. * call.c (enforce_access): Use the new extra argument to build the error message. (build_op_delete_call): Adjusted the call to perform_or_defer_access_check. (build_over_call): Likewise. PR c++/29475 * g++.dg/template/access19.C: New test. * g++.old-deja/g++.other/access11.C: Adjusted the line where the error is reported. From-SVN: r119027
2006-11-04call.c (build_op_delete_call): Test user-visible type against size_type_node...Roger Sayle1-1/+1
* call.c (build_op_delete_call): Test user-visible type against size_type_node, instead of against the internal type, sizetype. * class.c (type_requires_array_cookie): Likewise. * mangle.c (write_builtin_type) <INTEGER_TYPE>: Remove special handling of TYPE_IS_SIZETYPE. * typeck.c (type_after_usual_arithmetic_conversions): Remove special case handling of TYPE_IS_SIZETYPE. (comptypes): Likewise. From-SVN: r118472
2006-10-12re PR c++/27961 (ICE on invalid template declaration)Lee Millward1-0/+1
PR c++/27961 * decl.c (start_decl): Return error_mark_node if a function is initialized like a variable. (check_var_type): If a variable of field is declared void, set the type to error_mark_node. (grokdeclarator): Check the return type of check_var_type. * class.c (finish_struct_1): Robustify. * g++.dg/template/crash60.C: New test. * g++.dg/other/large-size-array.C: Adjust error markers. * g++.dg/parse/crash27.C: Likewise. * g++.dg/template/crash1.C: Likewise. From-SVN: r117671
2006-09-20re PR target/27650 (internal compiler error while compiling Gecode)Danny Smith1-0/+10
PR target/27650 * class.c (check_for_override): Remove dllimport from virtual methods. From-SVN: r117096
2006-08-30re PR c++/26670 (attribute((packed)) sometimes not ignored for non-PODs)Jason Merrill1-6/+10
PR c++/26670 * class.c (check_field_decls): Don't unset TYPE_PACKED until all the fields have been processed. From-SVN: r116591
2006-08-29re PR c++/26670 (attribute((packed)) sometimes not ignored for non-PODs)Jason Merrill1-4/+7
PR c++/26670 * class.c (check_field_decls): Unset TYPE_PACKED (t) if one of the fields can't be packed. From-SVN: r116555
2006-08-27re PR c++/26573 (Duplicate message for static member in local class)Lee Millward1-4/+0
PR c++/26573 * class.c (check_field_decls): Don't issue error about local classes containing static data members. * g++.dg/other/static2.C: New test. From-SVN: r116490
2006-08-26re PR c++/28588 (static private function)Mark Mitchell1-125/+36
PR c++/28588 * class.c (resolve_address_of_overloaded_function): Add access_path parameter. Perform access checks. (instantiate_type): Adjust call to resolve_address_of_overloaded_function. Remove unnecessary code. * tree.c (is_overloaded_fn): Document. Return 2 when there are acutally multiple functions. (really_overloaded_fn): Use is_overloaded_fn. * mangle.c (write_expression): Handle BASELINKs. * cp-tree.h (really_overloaded_fn): Return bool. (baselink_for_fns): Declare. * search.c (lookup_member): Check access for single static functions here. * pt.c (convert_nontype_argument_function): Handle BASELINKs. (tsubst_copy_and_build): Generate BASELINKs for template-ids. * semantics.c (finish_call_expr): Use baselink_for_fns. (baselink_for_fns): New function. (finish_id_expression): Use it. * parser.c (cp_parser_template_argument): Don't strip BASELINKs. PR c++/28595 * pt.c (tsubst): Issue errors about attempts to create VLAs at template-instantiation time. PR c++/28588 * g++.dg/inherit/access6.C: New test. * g++.dg/inherit/access7.C: Likewise. PR c++/28595 * g++.dg/template/array15.C: New test. * g++.dg/template/crash2.C: Tweak error markers. From-SVN: r116468
2006-07-05re PR c++/13983 (no warning on some non-POD struct with packed attribute)Jason Merrill1-36/+28
PR c++/13983 PR c++/17519 * stor-layout.c (finish_record_layout): Copy TYPE_PACKED to variants. * c-common.c (handle_packed_attribute): So don't copy it here. * c-decl.c (finish_struct): Don't copy TYPE_ALIGN. * cp/class.c (check_field_decls): Check TYPE_PACKED after stripping array types. (finish_struct_bits): Don't copy TYPE_SIZE here. From-SVN: r115217
2006-06-29re PR c++/26905 (default-visibility class symbol improperly resolved as ↵Jason Merrill1-0/+3
hidden-visibility) PR c++/26905 PR c++/26612 PR c++/27000 PR c++/26984 PR c++/19134 * tree.c (build_decl_stat): Don't hande #pragma visibility here. * c-common.c (c_determine_visibility): Handle it here. * c-decl.c (finish_decl): Call c_determine_visibility for functions, too. * flags.h (enum symbol_visibility): Sort from most to least visibility. * tree.h: Likewise. * varasm.c (default_assemble_visibility): Likewise. * c-common.c (handle_visibility_attribute): Complain about trying to give visibility to an already defined class, or trying to change declared visibility. Always attach the attribute. * cp/decl2.c (determine_visibility): Overhaul. (determine_visibility_from_class): Likewise. (min_vis_r, type_visibility, constrain_visibility): New fns. (constrain_visibility_for_template): Likewise. (constrain_class_visibility): Likewise. * cp/decl.c (cp_finish_decl): Call determine_visibility for function decls, too. * cp/name-lookup.c (pushtag): Call determine_visibility. * cp/decl.c (duplicate_decls): Don't copy visibility from template to specialization. * cp/pt.c (check_explicit_specialization): Likewise. (lookup_template_class, tsubst_decl): Call determine_visibility. * cp/class.c (finish_struct_1): Call constrain_class_visibility. PR c++/26905 PR c++/21675 PR c++/17470 * cp/parser.c (cp_parser_explicit_instantiation): Pass the attributes to grokdeclarator. (cp_parser_type_specifier): Allow 'enum __attribute ((...)) E'. (cp_parser_enum_specifier): Likewise. (cp_parser_elaborated_type_specifier): Apply attributes if this declares only the class. (cp_parser_class_specifier): Apply leading attributes immediately. * cp/semantics.c (begin_class_definition): Add attributes parameter, apply them to the type. * attribs.c (decl_attributes): Ignore type-in-place attributes once the type has been defined. PR c++/21581 PR c++/25915 * cp/tree.c (decl_anon_ns_mem_p): New function. * cp/cp-tree.h: Declare it. * cp/decl2.c (determine_visibility): Make anonymous namespace members static. (min_vis_r, constrain_visibility): Likewise. * cp/rtti.c (create_pseudo_type_info): Set TREE_PUBLIC on pseudo-types. * cp/decl.c (cxx_init_decl_processing): Set TREE_PUBLIC on global_namespace. * cp/name-lookup.c (push_namespace_with_attribs): Don't set TREE_PUBLIC on anonymous namespaces. From-SVN: r115086
2006-06-06Fix up whitespacingMike Stump1-25/+25
From-SVN: r114428
2006-05-30re PR c++/27803 (ICE with invalid bit-field)Mark Mitchell1-12/+12
PR c++/27803 * class.c (check_bitfield_decl): Ensure that all bitfields have integral type. PR c++/27803 * g++.dg/parse/bitfield1.C: New test. From-SVN: r114245
2006-05-02re PR c++/27309 (ICE on invalid constructor definition)Mark Mitchell1-0/+3
PR c++/27309 * class.c (add_method): Call grok_special_member_properties. * decl.c (grokdeclarator): Don't call it here. (copy_fn_p): A TEMPLATE_DECL is never a copy constructor or assignment operator. Set TYPE_HAS_CONSTURCTOR if DECL is a constructor. (start_method): Don't call grok_special_member_properties. * method.c (implicitly_declare_fn): Likewise. * pt.c (instantiate_class_template): Likewise. * decl2.c (grokfield): Likewise. PR c++/27309 * g++.dg/parser/ctor5.C: New test. From-SVN: r113473
2006-04-24re PR c++/19963 (ICE on invalid member declaration)Volker Reichelt1-0/+2
PR c++/19963 * class.c (layout_class_type): Skip fields with invalid types. * g++.dg/other/incomplete2.C: New test. From-SVN: r113220
2006-04-23re PR c++/26534 ([4.1] bitfield wrong optimize)Mark Mitchell1-0/+23
2006-04-23 Mark Mitchell <mark@codesourcery.com> PR c++/26534 * c-common.h (c_build_bitfield_integer_type): Declare. * c-decl.c (c_build_bitfield_integer_type): Move to ... * c-common.c (c_build_bitfield_integer_type): ... here. 2006-04-23 Mark Mitchell <mark@codesourcery.com> PR c++/26534 * cp-tree.h (is_bitfield_expr_with_lowered_type): New function. * typeck.c (is_bitfield_expr_with_lowered_type): New function. (decay_conversion): Convert bitfield expressions to the correct type. (build_modify_expr): Remove spurious conversions. * class.c (layout_class_type): Modify the type of bitfields to indicate a limited range. * call.c (standard_conversion): Adjust the type of bitfield expressions used in an rvalue context. (build_conditional_expr): Likewise. 2006-04-23 Mark Mitchell <mark@codesourcery.com> PR c++/26534 * g++.dg/opt/bitfield1.C: New test. * g++.dg/compat/abi/bitfield1_main.C: Add -w. * g++.dg/compat/abi/bitfield1_x.C: Likewise. * g++.dg/compat/abi/bitfield1_y.C: Likewise. * g++.dg/compat/abi/bitfield2_main.C: Likewise. * g++.dg/compat/abi/bitfield2_x.C: Likewise. * g++.dg/compat/abi/bitfield2_y.C: Likewise. * g++.dg/abi/bitfield1.C: Add dg-warning markers. * g++.dg/abi/bitfield2.C: Likewise. * g++.dg/init/bitfield1.C: Likewise. From-SVN: r113199
2006-04-19re PR c++/27102 (ICE with invalid class name in function template)Mark Mitchell1-13/+21
PR c++/27102 * class.c (currently_open_class): Tidy. * decl.c (grokdeclarator): If we encounter an erroneous declarator, assume that we have already issued an error message and return. Return error_mark_node instead of NULL_TREE in more places. Issue errors about function definitions that do not have a function declarator. Check for complete types for all function definitions. * cp-tree.h (cp_error_declarator): Remove. (currently_open_class): Change return type. * parser.c (cp_parser_id_expression): Add optional_p parameter. (cp_parser_parse_diagnose_invalid_type_name): Adjust calls. (cp_parser_id_expression): Likewise. (cp_parser_unqualified_id): If the name is optional, return NULL_TREE. (cp_parser_postfix_dot_deref_expression): Adjust calls. (cp_parser_type_parameter): Likewise. (cp_parser_unqualified_id): Likewise. (cp_parser_direct_declarator): Likewise. (cp_parser_declarator_id): Add optional_p parameter. (cp_parser_function_definition_from_specifiers_and_declarator): Assume that start_function indicates failure only if it has issued an error. (cp_parser_omp_var_list_no_open): Adjust calls. PR c++/27102 * g++.dg/template/crash35.C: Tweak error markers. * g++.dg/template/crash46.C: New test. * g++.old-deja/g++.brendan/friend4.C: Tweak error markers. * g++.old-deja/g++.pt/incomplete1.C: Likewise. From-SVN: r113081
2006-04-17PR c++/26114, c++/26115Janis Johnson1-2/+4
PR c++/26114, c++/26115 * typeck.c (cxx_mark_addressable): Restore check for extra_warnings. * class.c (check_field_decls): Ditto. From-SVN: r113010
2006-02-18re PR c++/26266 (Trouble with static const data members in template classes)Mark Mitchell1-1/+1
PR c++/26266 * cp-tree.h (cp_finish_decl): Adjust declaration. (grokbitfield): Likewise. (finish_static_data_member_decl): Likewise. * init.c (constant_value_1): Ensure processing_template_decl when folding non-dependent initializers for static data members of dependent types. Return error_mark_node for erroneous initailizers. * class.c (get_vtable_decl): Use finish_decl, not cp_finish_decl. * decl.c (cp_make_fname_decl): Adjust call to cp_finish_decl. (cp_finish_decl): Add init_const_expr_p parameter. Set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (finish_decl): Adjust call to cp_finish_decl. (compute_array_index_type): Robustify. (start_method): Use finish_decl, not cp_finish_decl. * rtti.c (emit_tinfo_decl): Likewise. * except.c (initialize_handler_parm): Adjust call to cp_finish_decl. (expand_start_catch_block): Likewise. * cvt.c (build_up_reference): Adjust call to cp_finish_decl. * pt.c (instantiate_class_template): Adjust call to finish_static_data_member_decl. (tsubst_expr): Use finish_decl, not cp_finish_decl. (instantiate_decl): Adjust call to cp_finish_decl. * name-lookup.c (pushdecl_top_level_1): Use finish_decl, not cp_finish_decl. * decl2.c (finish_static_data_member_decl): Add init_const_expr_p parameter. (grokfield): Likewise. * parser.c (cp_parser_condition): Check for constant initializers. (cp_parser_init_declarator): Adjust calls to grokfield and cp_finish_decl. Don't set DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P here. (cp_parser_member_declaration): Likewise. (cp_parser_objc_class_ivars): Likewise. PR c++/26266 * g++.dg/template/static22.C: New test. * g++.dg/template/static23.C: New test. * g++.dg/template/static24.C: New test. * g++.dg/template/non-dependent13.C: New test. From-SVN: r111229
2006-02-13cp-tree.h (warn_hidden): Remove prototype.Volker Reichelt1-1/+1
* cp-tree.h (warn_hidden): Remove prototype. * class.c (warn_hidden): Make static. From-SVN: r110936
2006-02-10class.c (debug_class): Remove extern.Volker Reichelt1-2/+2
* class.c (debug_class): Remove extern. (debug_thunks): Likewise. From-SVN: r110836
2006-02-03typeck.c (string_conv_p): Pass appropiate OPT_Wxxxx values when calling ↵Lee Millward1-8/+6
warning(). * typeck.c (string_conv_p): Pass appropiate OPT_Wxxxx values when calling warning(). (build_array_ref, cxx_mark_addressable): Likewise. (check_return_expr): Likewise. * init.c (perform_member_init): Likewise. (sort_mem_initializers, emit_mem_initializers): Likewise. * class.c (check_field_decls): Likewise. (warn_about_ambiguous_bases): Likewise. * decl.c (pop_label, poplevel): Likewise. (duplicate_decls, grok_op_properties): Likewise. (start_preparsed_function, finish_function): Likewise. * name-lookup.c (pushdecl_maybe_friend): Likewise. (pushdecl_maybe_friend): Likewise. * parser.c (cp_parser_warn_min_max): Likewise. (cp_parser_cast_expression): Likewise. * method.c (lazily_declare_fn): Likewise. * cvt.c (convert_to_void): Likewise. * mangle.c (finish_mangling): Likewise. * cp-gimplify.c (gimplify_expr_stmt): Likewise . From-SVN: r110567
2006-01-29call.c (alloc_conversion): Use cast when converting from void *.Gabriel Dos Reis1-5/+6
* call.c (alloc_conversion): Use cast when converting from void *. (alloc_conversions): Likewise. (add_candidate): Likewise. (print_z_candidates): Likewise. (add_warning): Likewise. * pt.c (retrieve_local_specialization): Likewise. (process_partial_specialization): Likewise. (mangle_class_name_for_template): Likewise. (tsubst_template_args): Likewise. * typeck2.c (pat_calc_hash): Likewise. (pat_compare): Likewise. (abstract_virtuals_error): Likewise. * class.c (method_name_cmp): Likewise. (resort_method_name_cmp): Likewise. (get_vfield_name): Likewise. * decl2.c (generate_ctor_and_dtor_functions_for_priority): Likewise. * lex.c (init_reswords): Likewise. * rtti.c (create_pseudo_type_info): Likewise. * search.c (dfs_lookup_base): Likewise. (dfs_dcast_hint_pre): Likewise. (dfs_dcast_hint_post): Likewise. * tree.c (hash_tree_cons): Likewise. * repo.c (extract_string): Likewise. (afgets): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_lookup): Likewise. * g++spec.c (lang_specific_driver): Likewise. From-SVN: r110366
2006-01-28class.c (check_bases): Likewise.Gabriel Dos Reis1-20/+31
* class.c (check_bases): Likewise. (maybe_warn_about_overly_private_class): Likewise. (check_field_decls): Likewise. (layout_empty_base): Likewise. (layout_virtual_bases): Likewise. (layout_class_type): Likewise. * call.c (joust): Pass option code to warning. Use inform for explanation. From-SVN: r110342
2006-01-28re PR c++/25855 (template specialisation not always found (partial ordering))Mark Mitchell1-1/+3
PR c++/25855 * class.c (resolve_address_of_overloaded_function): Adjust use of return value from most_specialized_instantiation. * pt.c (determine_specialization): Avoid multiple calls to get_bindings. (most_specialized_instantiation): When a tie occurs, set the current presumed champion to the next template. Return the TREE_LIST node containing the template, rather than the template itself. (most_specialized): Remove. * name-lookup.c (push_overloaded_decl): When duplicate_decls indicates a failed redeclaration, report that to callers. PR c++/25855 * g++.dg/template/spec29.C: New test. From-SVN: r110332
2006-01-25cp-tree.h (get_primary_binfo): Remove prototype.Volker Reichelt1-4/+3
* cp-tree.h (get_primary_binfo): Remove prototype. (push_using_decl): Likewise. (current_template_args): Likewise. (more_specialized_class): Likewise. (mark_class_instantiated): Likewise. (default_conversion): Likewise. (pfn_from_ptrmemfunc): Likewise. * class.c (get_primary_binfo): Add prototype, make static, simplify. * name-lookup.c (push_using_decl): Make static. * pt.c (current_template_args): Likewise. (more_specialized_class): Likewise. (mark_class_instantiated): Likewise. * typeck.c (default_conversion): Make static. (pfn_from_ptrmemfunc): Add prototype, make static. From-SVN: r110208
2006-01-23cp-tree.h (get_vtt_name): Remove prototype.Volker Reichelt1-10/+1
* cp-tree.h (get_vtt_name): Remove prototype. * class.c (get_vtt_name): Remove. (build_vtt): Call mangle_vtt_for_type instead of get_vtt_name. From-SVN: r110136
2006-01-22re PR c++/25895 (wrong code with ?: and derived class pointers)Mark Mitchell1-4/+12
PR c++/25895 * class.c (build_base_path): Generate a NOP_EXPR instead of a COMPONENT_REF if the base and derived classes are at the same address. PR c++/25856 * decl.c (begin_destructor_body): Robustify. PR c++/25858 * parser.c (cp_parser_direct_declarator): Robustify. PR c++/25895 * g++.dg/inherit/conv2.C: New test. PR c++/25856 * g++.dg/parse/dtor7.C: New test. PR c++/25858 * g++.dg/template/crash44.C: New test. From-SVN: r110084
2006-01-19re PR c++/25836 (G++ does not allow a conversion of templated types)Mark Mitchell1-10/+44
PR c++/25836 * cp-tree.h (push_class_stack): New function. (pop_class_stack): Likewise. * class.c (class_stack_node): Add hidden field. (pushclass): Clear it. (push_class_stack): New function. (pop_class_stack): Likewise. (currently_open_class): Ignore hidden classes. (currently_open_derived_class): Likewise. * name-lookup.c (push_to_top_level): Call push_class_stack. (pop_from_top_level): Call pop_class_stack. PR c++/25836 * g++.dg/template/init6.C: New test. From-SVN: r109945
2006-01-12re PR debug/24824 (ICE: in build_abbrev_table, at dwarf2out.c:6427 with ↵Nathan Sidwell1-1/+1
-feliminate-dwarf2-dups) PR c++/24824 * class.c (handle_using_decl): Pass correct scope to cp_emit_debug_info_for_using. PR c++/24824 * g++.dg/debug/dwarf2-1.C: New. From-SVN: r109643
2006-01-03re PR c++/25635 (Bogus cruft in error message for invalid operator declaration)Mark Mitchell1-1/+7
PR c++/25635 * class.c (add_method): Set TYPE_HAS_CONVERSION for classes with a conversion operator. * decl.c (grokdeclarator): Do not set TYPE_HAS_CONVERSION here. PR c++/25638 * class.c (add_method): Never associate more than one destructor with a single class. PR c++/25637 * cp-tree.h (do_friend): Adjust prototype. * decl.c (grokfndecl): Make funcdef_flag a bool, not an int. (grokdeclarator): Likewise. Refine check for invalid declarations/definitions of member functions outside of their own class. * friend.c (do_friend): Make funcdef_flag a bool, not an int. PR c++/25633 * parser.c (cp_parser_mem_initializer_list): Check result of cp_parser_mem_initializer against error_mark_node, not NULL_TREE. (cp_parser_mem_initializer): Return error_mark_node for failure. PR c++/25634 * parser.c (cp_parser_template_parameter_list): Call begin_template_parm_list and end_template_parm_list here. (cp_parser_type_parameter): Not here. (cp_parser_template_declaration_after_export): Or here. (cp_parser_elaborated_type_specifier): Call cp_parser_check_template_parameters. * tree.c (build_target_expr_with_type): Use force_target_expr. PR c++/25635 * g++.dg/parse/operator6.C: New test. PR c++/25637 * g++.dg/parse/error29.C: New test. PR c++/25638 * g++.dg/parse/dtor6.C: New test. PR c++/25633 * g++.dg/parse/ctor3.C: New test. PR c++/25634 * g++.dg/template/class3.C: New test. From-SVN: r109270