OSDN Git Service

Restore canonical type comparison for dependent type(def)s
[pf3gnuchains/gcc-fork.git] / gcc / cp / ChangeLog
index 95a2f8b..1ab6854 100644 (file)
@@ -1,6 +1,274 @@
+2010-11-02  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/45606
+       * cp-tree.h (TEMPLATE_TYPE_PARM_SIBLING_PARMS): Remove.
+       (struct template_parm_index_s)<num_siblings>: New field.
+       (TEMPLATE_PARM_NUM_SIBLINGS): New accessor.
+       (process_template_parm): Extend the API to accept the number of
+       template parms in argument.
+       (cp_set_underlying_type): Remove this.
+       * class.c (build_self_reference): Require canonical type equality
+       back on the self reference of class.
+       * decl2.c (grokfield): Require canonical type equality back on
+       typedef class fields.
+       * name-lookup.c (pushdecl_maybe_friend): Require canonical type
+       equality back on typedefs.
+       * parser.c (cp_parser_template_parameter_list): Do not require
+       canonical type equality on dependent types created during template
+       parameters parsing.
+       * pt.c (fixup_template_type_parm_type, fixup_template_parm_index)
+       (fixup_template_parm, fixup_template_parms): New private
+       functions.
+       (current_template_args): Declare this.
+       (process_template_parm): Pass the total number of template parms
+       to canonical_type_parameter.
+       (build_template_parm_index): Add a new argument to carry the total
+       number of template parms.
+       (reduce_template_parm_level, process_template_parm, make_auto):
+       Adjust.
+       (current_template_args): Fix this for template template
+       parameters.
+       (tsubst_template_parm): Split out of ...
+       (tsubst_template_parms): ... this.
+       (reduce_template_parm_level): Don't loose
+       TEMPLATE_PARM_NUM_SIBLINGS when cloning a TEMPLATE_PARM_INDEX.
+       (template_parm_to_arg): Extracted this function from
+       current_template_args. Make it represent invalid template parms
+       with an error_mark_node instead of a LIST_TREE containing an
+       error_mark_node.
+       (current_template_args): Use template_parm_to_arg.
+       (dependent_template_arg_p): Consider an invalid template argument
+       as dependent.
+       (end_template_parm_list): Do not update template sibling parms
+       here anymore. Use fixup_template_parms instead.
+       (process_template_parm): Pass the number of template parms to
+       canonical_type_parameter.
+       (make_auto): Require structural equality on auto
+       TEMPLATE_TYPE_PARM for now.
+       (unify)<BOUND_TEMPLATE_TEMPLATE_PARM>: Coerce template parameters
+       using all the arguments deduced so far.
+       (tsubst)<TEMPLATE_TYPE_PARM>: Pass the number of sibling parms to
+       canonical_type_parameter.
+       * tree.c (cp_set_underlying_type): Remove.
+       * typeck.c (get_template_parms_of_dependent_type)
+       (incompatible_dependent_types_p): Remove.
+       (structural_comptypes): Do not call incompatible_dependent_types_p
+       anymore.
+       (comp_template_parms_position): Re-organized. Take the length of
+       template parms list in account.
+
+2010-11-01  Jason Merrill  <jason@redhat.com>
+
+       * semantics.c (call_stack, call_stack_tick, cx_error_context): New.
+       (last_cx_error_tick, push_cx_call_context, pop_cx_call_context): New.
+       (cxx_eval_call_expression): Call push/pop_cx_call_context instead
+       of giving follow-on errors.
+       * error.c (maybe_print_constexpr_context): New.
+       (cp_diagnostic_starter): Call it.
+       * cp-tree.h: Declare cx_error_context.
+
+       * semantics.c (cxx_eval_constant_expression): Explain
+       unacceptable use of variable better.
+
+2010-11-01  Gabriel Dos Reis  <gdr@cse.tamu.edu>
+           Jason Merrill  <jason@redhat.com>
+
+       * call.c (null_ptr_cst_p): Use maybe_constant_value.
+       (set_up_extended_ref_temp): Support constant initialization.
+       (initialize_reference): Adjust.
+       * class.c (check_bitfield_decl): Use cxx_constant_value.
+       * cvt.c (ocp_convert): Don't use integral_constant_value when
+       converting to class type.
+       * decl.c (finish_case_label): Use maybe_constant_value.
+       (build_init_list_var_init): Support constant initialization.
+       (check_initializer): Likewise.  Reorganize.
+       (cp_finish_decl): Likewise.
+       (expand_static_init): Likewise.
+       (compute_array_index_type): Use maybe_constant_value.
+       Add complain parm.
+       (create_array_type_for_decl, grokdeclarator): Pass it.
+       (build_enumerator): Use cxx_constant_value.
+       * decl2.c (grokfield): Use maybe_constant_init.
+       * except.c (check_noexcept_r): Handle constexpr.
+       (build_noexcept_spec): Use maybe_constant_value.
+       * init.c (expand_default_init): Support constant initialization.
+       (build_vec_init): Likewise.
+       (constant_value_1): Adjust.
+       (build_new_1): Adjust.
+       * parser.c (cp_parser_constant_expression): Allow non-integral
+       in C++0x mode.
+       (cp_parser_direct_declarator): Don't fold yet in C++0x mode.
+       (cp_parser_initializer_clause): Toss folded result if non-constant.
+       * pt.c (fold_decl_constant_value): Remove.
+       (convert_nontype_argument): Use maybe_constant_value.  Give clearer
+       error about overflow.
+       (tsubst): Move array bounds handling into compute_array_index_type.
+       (value_dependent_expression_p): Handle constant CALL_EXPR.
+       (tsubst_decl): Don't set
+       DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P yet.
+       (tsubst_expr) [DECL_EXPR]: Pass it into cp_finish_decl.
+       (instantiate_decl): Here too.
+       * semantics.c (finish_static_assert): Use maybe_constant_value.
+       (ensure_literal_type_for_constexpr_object): Make sure type is complete.
+       (potential_constant_expression): Use maybe_constant_value.
+       * tree.c (cast_valid_in_integral_constant_expression_p): Any cast
+       is potentially valid in C++0x.
+       * typeck2.c (store_init_value): Handle constant init.
+       (check_narrowing): Use maybe_constant_value.
+       (build_functional_cast): Set TREE_CONSTANT on literal T().
+       * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove.
+       (LOOKUP_ALREADY_DIGESTED): New.
+       (compute_array_index_type): Adjust prototype.
+
+       * semantics.c (constexpr_call): New datatype.
+       (constexpr_call_table): New global table.
+       (constexpr_call_hash): New.
+       (constexpr_call_equal): Likewise.
+       (maybe_initialize_constexpr_call_table): Likewise.
+       (lookup_parameter_binding): Likewise.
+       (cxx_eval_builtin_function_call): Likewise.
+       (cxx_bind_parameters_in_call): Likewise.
+       (cxx_eval_call_expression): Likewise.
+       (cxx_eval_unary_expression): Likewise.
+       (cxx_eval_binary_expression): Likewise.
+       (cxx_eval_conditional_expression): Likewise.
+       (cxx_eval_array_reference): Likewise.
+       (cxx_eval_component_reference): Likewise.
+       (cxx_eval_logical_expression): Likewise.
+       (cxx_eval_object_construction): Likewise.
+       (cxx_eval_constant_expression): Likewise.
+       (cxx_eval_indirect_ref): Likewise.
+       (cxx_constant_value): Likewise.
+       (cxx_eval_bare_aggregate): Likewise.
+       (adjust_temp_type): New.
+       (reduced_constant_expression_p): New.
+       (verify_constant): New.
+       (cxx_eval_vec_init, cxx_eval_vec_init_1): New.
+       (cxx_eval_outermost_constant_expr): New.
+       (maybe_constant_value, maybe_constant_init): New.
+       (cxx_eval_constant_expression): Use them.
+       * pt.c (iterative_hash_template_arg): No longer static.
+       * cp-tree.h: Declare fns.
+
+       * cp-tree.h (register_constexpr_fundef): Declare.
+       * decl.c (maybe_save_function_definition): New.
+       (finish_function): Use it.
+       * semantics.c (constexpr_fundef): New datatype.
+       (constexpr_fundef_table): New global table.
+       (constexpr_fundef_equal): New.
+       (constexpr_fundef_hash): Likewise.
+       (retrieve_constexpr_fundef): Likewise.
+       (validate_constexpr_fundecl): Store in the table.
+       (build_data_member_initialization): New fn.
+       (build_constexpr_constructor_member_initializers): New.
+       (register_constexpr_fundef): Define.
+       (is_this_parameter): New.
+       (get_function_named_in_call): Likewise.
+       (get_nth_callarg): Likewise.
+       (check_automatic_or_tls): New.
+       (morally_constexpr_builtin_function_p): New.
+       (potential_constant_expression): New.
+
+2010-11-01  Jason Merrill  <jason@redhat.com>
+
+       * decl2.c (decl_constant_var_p): New fn.
+       (decl_maybe_constant_var_p): New fn.
+       (mark_used): Rework instantiation of things needed for constant
+       expressions.
+       * cp-tree.h: Declare new fns.
+       * pt.c (instantiate_decl): Handle cp_unevaluated_operand.
+       (always_instantiate_p): Use decl_maybe_constant_var_p.
+       (instantiate_decl): Don't defer constexpr functions.
+       * repo.c (repo_emit_p): Use decl_maybe_constant_var_p.
+       * semantics.c (finish_id_expression): Use decl_constant_var_p.
+       Check for valid name in constant expr after mark_used.
+
+2010-10-31  Jason Merrill  <jason@redhat.com>
+
+       * class.c (is_really_empty_class): Work when type is not complete.
+       (synthesized_default_constructor_is_constexpr): New.
+       (add_implicitly_declared_members): Use it.
+       (type_has_constexpr_default_constructor): Likewise.
+       * cp-tree.h: Declare it.
+       * method.c (synthesized_method_walk): Use it.
+
+       * decl.c (pop_switch): Use EXPR_LOC_OR_HERE.
+       * typeck.c (convert_for_assignment): Likewise.
+
+       * parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
+       message about constexpr without -std=c++0x.
+
+       * decl.c (grokdeclarator): Don't ICE on constexpr non-static data
+       member.
+
+2010-10-30  Nathan Froyd  <froydnj@codesourcery.com>
+
+       * class.c (layout_vtable_decl): Call build_array_of_n_type.
+       (build_vtt, build_ctor_vtabl_group): Likewise.
+
+2010-10-30  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       Implemented Objective-C 2.0 @property, @synthesize and @dynamic.
+       * parser.c (cp_parser_objc_at_property_declaration): Removed
+       parsing of RID_COPIES and RID_IVAR.  Updated call to
+       objc_add_property_declaration.
+       * typecheck.c (finish_class_member_access_expr): Call
+       objc_maybe_build_component_ref instead of objc_build_setter_call.
+       (cp_build_modify_expr): Call objc_maybe_build_modify_expr instead
+       of objc_build_getter_call.
+
+2010-10-27  Jason Merrill  <jason@redhat.com>
+
+       * cp-tree.h (cp_trait_kind): Add CPTK_IS_LITERAL_TYPE.
+       * cxx-pretty-print.c (pp_cxx_trait_expression): Handle it.
+       * semantics.c (trait_expr_value, finish_trait_expr): Likewise.
+       * parser.c (cp_parser_primary_expression): Handle RID_IS_LITERAL_TYPE.
+       (cp_parser_trait_expr): Likewise.
+
 2010-10-27  Gabriel Dos Reis  <gdr@cse.tamu.edu>
            Jason Merrill  <jason@redhat.com>
 
+       * decl.c (finish_case_label): Use decl_constant_value.
+
+       * method.c (synthesized_method_walk): Track constexprness too.
+       (process_subob_fn, walk_field_subobs): Likewise.
+       (implicitly_declare_fn): Set DECL_DECLARED_CONSTEXPR_P.
+       (defaulted_late_check): Handle DECL_DECLARED_CONSTEXPR_P.
+       * class.c (add_implicitly_declared_members): Handle
+       constexpr default ctor.
+
+       * parser.c (cp_parser_ctor_initializer_opt_and_function_body):
+       Make sure a constexpr ctor has an empty body.
+       * class.c (type_has_constexpr_default_constructor): New.
+       * cp-tree.h: Declare it.
+       * init.c (perform_member_init): Complain about uninitialized
+       member in constexpr ctor.
+       (emit_mem_initializers): And uninitialized base.
+       * decl.c (check_tag_decl): Fix typo.
+
+       * semantics.c (valid_type_in_constexpr_fundecl_p): New fn.
+       (is_valid_constexpr_fn): New fn.
+       (validate_constexpr_fundecl): Use it.
+       * decl.c (validate_constexpr_redeclaration): New.
+       (duplicate_decls): Use it.
+       (cp_finish_decl): Call validate_constexpr_fundecl and
+       ensure_literal_type_for_constexpr_object here.
+       (start_decl): Not here.  Don't ICE on constexpr reference.
+       (check_for_uninitialized_const_var): Don't handle constexpr specially.
+       (grokfndecl): Set DECL_DECLARED_CONSTEXPR_P.
+       (check_static_variable_definition): Give friendly message about
+       missing constexpr.
+       (grokdeclarator): Complain about typedef and volatile with constexpr.
+       Reorganize.  Give sorry about non-static data members in C++0x mode.
+       (start_preparsed_function): Check validate_constexpr_fundecl here.
+       (check_function_type): Not here.
+       * decl2.c (finish_static_data_member_decl): Don't complain about
+       in-class init.
+       * parser.c (CP_PARSER_FLAGS_ONLY_TYPE_OR_CONSTEXPR): New.
+       (cp_parser_condition): Pass it to cp_parser_decl_specifier_seq.
+       (cp_parser_decl_specifier_seq): Handle it.
+       (cp_parser_explicit_instantiation): Diagnose inline and constexpr.
+
        * class.c (check_bases): Propagate non-literality.
        (check_field_decls): Likewise.
        (finalize_literal_type_property): New.