* cp-tree.h (instantiate_type_flags): New enumeration.
(instantiate_type): Change parameter.
* class.c (instantiate_type): Adjust prototype. Adjust.
* call.c (standard_conversion): Adjust instantiate_type call.
(reference_binding): Likewise.
(build_op_delete_call): Likewise.
(convert_like_real): Likewise.
* cvt.c (cp_convert_to_pointer): Likewise.
(convert_to_reference): Likewise.
* pt.c (convert_nontype_argument): Likewise.
* typeck.c (build_binary_op): Likewise.
(build_ptrmemfunc): Likewise.
(convert_for_assignment): Likewise.
From-SVN: r35757
2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+ * cp-tree.h (instantiate_type_flags): New enumeration.
+ (instantiate_type): Change parameter.
+ * class.c (instantiate_type): Adjust prototype. Adjust.
+ * call.c (standard_conversion): Adjust instantiate_type call.
+ (reference_binding): Likewise.
+ (build_op_delete_call): Likewise.
+ (convert_like_real): Likewise.
+ * cvt.c (cp_convert_to_pointer): Likewise.
+ (convert_to_reference): Likewise.
+ * pt.c (convert_nontype_argument): Likewise.
+ * typeck.c (build_binary_op): Likewise.
+ (build_ptrmemfunc): Likewise.
+ (convert_for_assignment): Likewise.
+
+2000-08-17 Nathan Sidwell <nathan@codesourcery.com>
+
* cp-tree.h (CPTR_AGGR_TAG): New global tree node.
(current_aggr): Define.
* decl.c (grokdeclarator): Make sure a friend class is an
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, 0);
+ expr = instantiate_type (to, expr, itf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
if (TREE_CODE (to) == FUNCTION_TYPE && expr && type_unknown_p (expr))
{
- expr = instantiate_type (to, expr, 0);
+ expr = instantiate_type (to, expr, itf_none);
if (expr == error_mark_node)
return NULL_TREE;
from = TREE_TYPE (expr);
if (type != TYPE_MAIN_VARIANT (type))
addr = cp_convert (build_pointer_type (TYPE_MAIN_VARIANT (type)), addr);
- fn = instantiate_type (fntype, fns, 2);
+ fn = instantiate_type (fntype, fns, itf_no_attributes);
if (fn != error_mark_node)
{
tree_cons (NULL_TREE, sizetype, void_list_node));
fntype = build_function_type (void_type_node, argtypes);
- fn = instantiate_type (fntype, fns, 2);
+ fn = instantiate_type (fntype, fns, itf_no_attributes);
if (fn != error_mark_node)
{
}
case IDENTITY_CONV:
if (type_unknown_p (expr))
- expr = instantiate_type (TREE_TYPE (convs), expr, 1);
+ expr = instantiate_type (TREE_TYPE (convs), expr, itf_complain);
return expr;
case AMBIG_CONV:
/* Call build_user_type_conversion again for the error. */
/* This function will instantiate the type of the expression given in
RHS to match the type of LHSTYPE. If errors exist, then return
- error_mark_node. We only complain is COMPLAIN is set. If we are
- not complaining, never modify rhs, as overload resolution wants to
- try many possible instantiations, in hopes that at least one will
- work.
-
- FLAGS is a bitmask, as we see at the top of the function.
-
+ error_mark_node. FLAGS is a bit mask. If ITF_COMPLAIN is set, then
+ we complain on errors. If we are not complaining, never modify rhs,
+ as overload resolution wants to try many possible instantiations, in
+ the hope that at least one will work.
+
For non-recursive calls, LHSTYPE should be a function, pointer to
function, or a pointer to member function. */
tree
instantiate_type (lhstype, rhs, flags)
tree lhstype, rhs;
- int flags;
+ enum instantiate_type_flags flags;
{
- int complain = (flags & 1);
- int strict = (flags & 2) ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
- tree r;
+ int complain = (flags & itf_complain);
+ int strict = (flags & itf_no_attributes)
+ ? COMPARE_NO_ATTRIBUTES : COMPARE_STRICT;
if (TREE_CODE (lhstype) == UNKNOWN_TYPE)
{
sfk_conversion /* A conversion operator. */
} special_function_kind;
+/* Bitmask flags to pass to instantiate_type. */
+typedef enum instantiate_type_flags {
+ itf_none = 0, /* nothing special */
+ itf_complain = 1 << 0, /* complain about errors */
+ itf_no_attributes = 1 << 1 /* ignore attributes on comparisons */
+} instantiate_type_flags;
+
/* Non-zero means that if a label exists, and no other identifier
applies, use the value of the label. */
extern int flag_labels_ok;
extern void pop_nested_class PARAMS ((void));
extern void push_lang_context PARAMS ((tree));
extern void pop_lang_context PARAMS ((void));
-extern tree instantiate_type PARAMS ((tree, tree, int));
+extern tree instantiate_type PARAMS ((tree, tree, enum instantiate_type_flags));
extern void print_class_statistics PARAMS ((void));
extern int first_vfun_index PARAMS ((tree));
extern void build_self_reference PARAMS ((void));
}
if (type_unknown_p (expr))
- return instantiate_type (type, expr, 1);
+ return instantiate_type (type, expr, itf_no_attributes);
cp_error ("cannot convert `%E' from type `%T' to type `%T'",
expr, intype, type);
if (TREE_CODE (type) == FUNCTION_TYPE && intype == unknown_type_node)
{
expr = instantiate_type (type, expr,
- (flags & LOOKUP_COMPLAIN) != 0);
+ (flags & LOOKUP_COMPLAIN)
+ ? itf_complain : itf_none);
if (expr == error_mark_node)
return error_mark_node;
else
fns = expr;
- fn = instantiate_type (type_pointed_to, fns, 0);
+ fn = instantiate_type (type_pointed_to, fns, itf_none);
if (fn == error_mark_node)
return error_mark_node;
set (_over.over_). */
tree fn;
- fn = instantiate_type (type_referred_to, expr, 0);
+ fn = instantiate_type (type_referred_to, expr, itf_none);
if (fn == error_mark_node)
return error_mark_node;
if (TREE_CODE (expr) != ADDR_EXPR)
return error_mark_node;
- expr = instantiate_type (type, expr, 0);
+ expr = instantiate_type (type, expr, itf_none);
if (expr == error_mark_node)
return error_mark_node;
/* DTRT if one side is an overloaded function, but complain about it. */
if (type_unknown_p (op0))
{
- tree t = instantiate_type (TREE_TYPE (op1), op0, 0);
+ tree t = instantiate_type (TREE_TYPE (op1), op0, itf_none);
if (t != error_mark_node)
{
cp_pedwarn ("assuming cast to type `%T' from overloaded function",
}
if (type_unknown_p (op1))
{
- tree t = instantiate_type (TREE_TYPE (op0), op1, 0);
+ tree t = instantiate_type (TREE_TYPE (op0), op1, itf_none);
if (t != error_mark_node)
{
cp_pedwarn ("assuming cast to type `%T' from overloaded function",
}
if (type_unknown_p (pfn))
- return instantiate_type (type, pfn, 1);
+ return instantiate_type (type, pfn, itf_complain);
fn = TREE_OPERAND (pfn, 0);
my_friendly_assert (TREE_CODE (fn) == FUNCTION_DECL, 0);
overloaded function. Call instantiate_type to get error
messages. */
if (rhstype == unknown_type_node)
- instantiate_type (type, rhs, 1);
+ instantiate_type (type, rhs, itf_complain);
else if (fndecl)
cp_error ("cannot convert `%T' to `%T' for argument `%P' to `%D'",
rhstype, type, parmnum, fndecl);