summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/call.c11
-rw-r--r--gcc/cp/cp-objcp-common.c4
-rw-r--r--gcc/cp/except.c2
-rw-r--r--gcc/cp/init.c4
-rw-r--r--gcc/cp/typeck.c5
6 files changed, 34 insertions, 10 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 432b5b2e5e6..566b80b3a3f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,23 @@
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.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 79b8cd5bc6f..a504dc84abc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5514,15 +5514,18 @@ build_new_method_call (tree instance, tree fns, tree args,
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);
diff --git a/gcc/cp/cp-objcp-common.c b/gcc/cp/cp-objcp-common.c
index b83ef363b8d..fbd407c3e12 100644
--- a/gcc/cp/cp-objcp-common.c
+++ b/gcc/cp/cp-objcp-common.c
@@ -44,7 +44,9 @@ cxx_get_alias_set (tree t)
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);
diff --git a/gcc/cp/except.c b/gcc/cp/except.c
index 081dd0fa422..2fe0be1afc0 100644
--- a/gcc/cp/except.c
+++ b/gcc/cp/except.c
@@ -682,7 +682,7 @@ build_throw (tree exp)
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
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index 3c74812e01a..19093194ad6 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -1134,7 +1134,6 @@ build_aggr_init (tree exp, tree init, int flags)
/* 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;
@@ -1142,7 +1141,6 @@ build_aggr_init (tree exp, tree init, int flags)
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;
@@ -2320,7 +2318,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type,
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,
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index b4d70162d9d..f0196088219 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -2646,7 +2646,7 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function)
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
@@ -6056,6 +6056,9 @@ build_ptrmemfunc1 (tree type, tree delta, tree pfn)
/* 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);