summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/cp/call.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
committerobrien <obrien@FreeBSD.org>2002-05-09 20:02:13 +0000
commitc8f5fc7032940ad6633f932ac40cade82ec4d0cc (patch)
tree29a0f0a6c79a69ecc64f612947a0fe5904311713 /contrib/gcc/cp/call.c
parentc9ab9ae440a8066b2c2b85b157b1fdadcf09916a (diff)
downloadFreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.zip
FreeBSD-src-c8f5fc7032940ad6633f932ac40cade82ec4d0cc.tar.gz
Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT.
Diffstat (limited to 'contrib/gcc/cp/call.c')
-rw-r--r--contrib/gcc/cp/call.c69
1 files changed, 54 insertions, 15 deletions
diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c
index cf6f0b4..5527066 100644
--- a/contrib/gcc/cp/call.c
+++ b/contrib/gcc/cp/call.c
@@ -408,6 +408,9 @@ build_call (function, parms)
nothrow = ((decl && TREE_NOTHROW (decl))
|| TYPE_NOTHROW_P (TREE_TYPE (TREE_TYPE (function))));
+ if (decl && TREE_THIS_VOLATILE (decl))
+ current_function_returns_abnormally = 1;
+
if (decl && TREE_DEPRECATED (decl))
warn_deprecated_use (decl);
@@ -702,7 +705,7 @@ standard_conversion (to, from, expr)
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, itf_none);
+ expr = instantiate_type (to, expr, tf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
@@ -792,9 +795,8 @@ standard_conversion (to, from, expr)
{
tree fbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (from));
tree tbase = TYPE_OFFSET_BASETYPE (TREE_TYPE (to));
- tree binfo = lookup_base (tbase, fbase, ba_check, NULL);
- if (binfo && !binfo_from_vbase (binfo)
+ if (DERIVED_FROM_P (fbase, tbase)
&& (same_type_ignoring_top_level_qualifiers_p
(TREE_TYPE (TREE_TYPE (from)),
TREE_TYPE (TREE_TYPE (to)))))
@@ -840,9 +842,8 @@ standard_conversion (to, from, expr)
tree tofn = TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (to));
tree fbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fromfn)));
tree tbase = TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (tofn)));
- tree binfo = lookup_base (tbase, fbase, ba_check, NULL);
- if (!binfo || binfo_from_vbase (binfo)
+ if (!DERIVED_FROM_P (fbase, tbase)
|| !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn))
|| !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)),
TREE_CHAIN (TYPE_ARG_TYPES (tofn)))
@@ -1105,7 +1106,7 @@ reference_binding (rto, rfrom, expr, flags)
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, itf_none);
+ expr = instantiate_type (to, expr, tf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
@@ -2237,6 +2238,36 @@ add_template_candidate_real (candidates, tmpl, ctype, explicit_targs,
if (fn == error_mark_node)
return candidates;
+ /* In [class.copy]:
+
+ A member function template is never instantiated to perform the
+ copy of a class object to an object of its class type.
+
+ It's a little unclear what this means; the standard explicitly
+ does allow a template to be used to copy a class. For example,
+ in:
+
+ struct A {
+ A(A&);
+ template <class T> A(const T&);
+ };
+ const A f ();
+ void g () { A a (f ()); }
+
+ the member template will be used to make the copy. The section
+ quoted above appears in the paragraph that forbids constructors
+ whose only parameter is (a possibly cv-qualified variant of) the
+ class type, and a logical interpretation is that the intent was
+ to forbid the instantiation of member templates which would then
+ have that form. */
+ if (DECL_CONSTRUCTOR_P (fn) && list_length (arglist) == 2)
+ {
+ tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn);
+ if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),
+ ctype))
+ return candidates;
+ }
+
if (obj != NULL_TREE)
/* Aha, this is a conversion function. */
cand = add_conv_candidate (candidates, fn, obj, arglist);
@@ -3577,8 +3608,7 @@ builtin:
match with the placement new is accepted.
CODE is either DELETE_EXPR or VEC_DELETE_EXPR.
- ADDR is the pointer to be deleted. For placement delete, it is also
- used to determine what the corresponding new looked like.
+ ADDR is the pointer to be deleted.
SIZE is the size of the memory block to be deleted.
FLAGS are the usual overloading flags.
PLACEMENT is the corresponding placement new call, or NULL_TREE. */
@@ -3623,15 +3653,22 @@ build_op_delete_call (code, addr, size, flags, placement)
if (placement)
{
- /* placement is a CALL_EXPR around an ADDR_EXPR around a function. */
+ tree alloc_fn;
+ tree call_expr;
+ /* Find the allocation function that is being called. */
+ call_expr = placement;
+ /* Sometimes we have a COMPOUND_EXPR, rather than a simple
+ CALL_EXPR. */
+ while (TREE_CODE (call_expr) == COMPOUND_EXPR)
+ call_expr = TREE_OPERAND (call_expr, 1);
/* Extract the function. */
- argtypes = TREE_OPERAND (TREE_OPERAND (placement, 0), 0);
+ alloc_fn = get_callee_fndecl (call_expr);
+ my_friendly_assert (alloc_fn != NULL_TREE, 20020327);
/* Then the second parm type. */
- argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (argtypes)));
-
+ argtypes = TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (alloc_fn)));
/* Also the second argument. */
- args = TREE_CHAIN (TREE_OPERAND (placement, 1));
+ args = TREE_CHAIN (TREE_OPERAND (call_expr, 1));
}
else
{
@@ -3861,7 +3898,7 @@ convert_like_real (convs, expr, fn, argnum, inner)
}
case IDENTITY_CONV:
if (type_unknown_p (expr))
- expr = instantiate_type (totype, expr, itf_complain);
+ expr = instantiate_type (totype, expr, tf_error | tf_warning);
return expr;
case AMBIG_CONV:
/* Call build_user_type_conversion again for the error. */
@@ -4268,7 +4305,8 @@ build_over_call (cand, args, flags)
be touched as it might overlay things. When the
gcc core learns about empty classes, we can treat it
like other classes. */
- && !is_empty_class (DECL_CONTEXT (fn)))
+ && !(is_empty_class (DECL_CONTEXT (fn))
+ && TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))))
{
tree address;
tree to = stabilize_reference
@@ -4304,6 +4342,7 @@ build_over_call (cand, args, flags)
Ideally, the notions of having side-effects and of being
useless would be orthogonal. */
TREE_SIDE_EFFECTS (val) = 1;
+ TREE_NO_UNUSED_WARNING (val) = 1;
}
else
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
OpenPOWER on IntegriCloud