PR c++/22369
PR c++/22451
* call.c (build_new_method_call): Convert initializer to
the basetype.
* init.c (build_aggr_init): Do not fiddle with types.
(build_vec_delete_1): Use correct type for POINTER_PLUS_EXPR.
* except.c (build_throw): Do not drop qualifiers for the
pointer type.
* typeck.c (get_member_function_from_ptrfunc): Do not
fiddle with types, instead convert.
(build_ptrmemfunc1): Convert to the target type for
initialization.
(gfc_trans_allocate): Convert result to target type.
* cp-objcp-common.c (cxx_get_alias_set): Pointers to
pointer-to-member structures shall have alias set zero as well.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127647
138bc75d-0d04-0410-961f-
82ee72b054a4
2007-08-20 Richard Guenther <rguenther@suse.de>
+ PR c++/22369
+ PR c++/22451
+ * call.c (build_new_method_call): Convert initializer to
+ the basetype.
+ * init.c (build_aggr_init): Do not fiddle with types.
+ (build_vec_delete_1): Use correct type for POINTER_PLUS_EXPR.
+ * except.c (build_throw): Do not drop qualifiers for the
+ pointer type.
+ * typeck.c (get_member_function_from_ptrfunc): Do not
+ fiddle with types, instead convert.
+ (build_ptrmemfunc1): Convert to the target type for
+ initialization.
+ (gfc_trans_allocate): Convert result to target type.
+ * cp-objcp-common.c (cxx_get_alias_set): Pointers to
+ pointer-to-member structures shall have alias set zero as well.
+
+2007-08-20 Richard Guenther <rguenther@suse.de>
+
* cp-objcp-common.h (LANG_HOOKS_TREE_INLINING_AUTO_VAR_IN_FN_P):
Remove.
* cp-tree.h (cp_auto_var_in_fn_p): Remove.
instance_ptr = build_this (instance);
- /* It's OK to call destructors on cv-qualified objects. Therefore,
- convert the INSTANCE_PTR to the unqualified type, if necessary. */
- if (DECL_DESTRUCTOR_P (fn))
+ /* It's OK to call destructors and constructors on cv-qualified objects.
+ Therefore, convert the INSTANCE_PTR to the unqualified type, if
+ necessary. */
+ if (DECL_DESTRUCTOR_P (fn)
+ || DECL_CONSTRUCTOR_P (fn))
{
tree type = build_pointer_type (basetype);
if (!same_type_p (type, TREE_TYPE (instance_ptr)))
instance_ptr = build_nop (type, instance_ptr);
- name = complete_dtor_identifier;
}
+ if (DECL_DESTRUCTOR_P (fn))
+ name = complete_dtor_identifier;
class_type = (conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE);
mem_args = tree_cons (NULL_TREE, instance_ptr, args);
return get_alias_set (TYPE_CONTEXT (t));
/* Punt on PMFs until we canonicalize functions properly. */
- if (TYPE_PTRMEMFUNC_P (t))
+ if (TYPE_PTRMEMFUNC_P (t)
+ || (POINTER_TYPE_P (t)
+ && TYPE_PTRMEMFUNC_P (TREE_TYPE (t))))
return 0;
return c_common_get_alias_set (t);
respectively. */
temp_type = is_bitfield_expr_with_lowered_type (exp);
if (!temp_type)
- temp_type = type_decays_to (TYPE_MAIN_VARIANT (TREE_TYPE (exp)));
+ temp_type = type_decays_to (TREE_TYPE (exp));
/* OK, this is kind of wacky. The standard says that we call
terminate when the exception handling mechanism, after
/* Just know that we've seen something for this node. */
TREE_USED (exp) = 1;
- TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type);
is_global = begin_init_stmts (&stmt_expr, &compound_stmt);
destroy_temps = stmts_are_full_exprs_p ();
current_stmt_tree ()->stmts_are_full_exprs_p = 0;
init, LOOKUP_NORMAL|flags);
stmt_expr = finish_init_stmts (is_global, stmt_expr, compound_stmt);
current_stmt_tree ()->stmts_are_full_exprs_p = destroy_temps;
- TREE_TYPE (exp) = type;
TREE_READONLY (exp) = was_const;
TREE_THIS_VOLATILE (exp) = was_volatile;
tbase = create_temporary_var (ptype);
tbase_init = build_modify_expr (tbase, NOP_EXPR,
fold_build2 (POINTER_PLUS_EXPR, ptype,
- base,
+ fold_convert (ptype, base),
virtual_size));
DECL_REGISTER (tbase) = 1;
controller = build3 (BIND_EXPR, void_type_node, tbase,
e2 = build1 (NOP_EXPR, TREE_TYPE (e2),
build_unary_op (ADDR_EXPR, e2, /*noconvert=*/1));
- TREE_TYPE (e2) = TREE_TYPE (e3);
+ e2 = fold_convert (TREE_TYPE (e3), e2);
e1 = build_conditional_expr (e1, e2, e3);
/* Make sure this doesn't get evaluated first inside one of the
/* Make sure DELTA has the type we want. */
delta = convert_and_check (delta_type_node, delta);
+ /* Convert to the correct target type if necessary. */
+ pfn = fold_convert (TREE_TYPE (pfn_field), pfn);
+
/* Finish creating the initializer. */
v = VEC_alloc(constructor_elt, gc, 2);
CONSTRUCTOR_APPEND_ELT(v, pfn_field, pfn);