an rvalue of type std::nullptr_t. */
t = integral_constant_value (t);
if (t == null_node
- || TREE_CODE (TREE_TYPE (t)) == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (TREE_TYPE (t)))
return true;
if (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t))
{
null pointer constant of integral type can be converted to an
rvalue of type std::nullptr_t. */
if ((tcode == POINTER_TYPE || TYPE_PTR_TO_MEMBER_P (to)
- || tcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (to))
&& expr && null_ptr_cst_p (expr))
conv = build_conv (ck_std, to, conv);
else if ((tcode == INTEGER_TYPE && fcode == POINTER_TYPE)
|| UNSCOPED_ENUM_P (from)
|| fcode == POINTER_TYPE
|| TYPE_PTR_TO_MEMBER_P (from)
- || fcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (from))
{
conv = build_conv (ck_std, to, conv);
if (fcode == POINTER_TYPE
|| TYPE_PTRMEM_P (from)
|| (TYPE_PTRMEMFUNC_P (from)
&& conv->rank < cr_pbool)
- || fcode == NULLPTR_TYPE)
+ || NULLPTR_TYPE_P (from))
conv->rank = cr_pbool;
return conv;
}
return_type, strict, flags);
if (i != 0)
- return NULL;
+ goto fail;
fn = instantiate_template (tmpl, targs, tf_none);
if (fn == error_mark_node)
- return NULL;
+ goto fail;
/* In [class.copy]:
tree arg_types = FUNCTION_FIRST_USER_PARMTYPE (fn);
if (arg_types && same_type_p (TYPE_MAIN_VARIANT (TREE_VALUE (arg_types)),
ctype))
- return NULL;
+ goto fail;
}
if (obj != NULL_TREE)
cand->template_decl = DECL_TEMPLATE_INFO (fn);
return cand;
+ fail:
+ return add_candidate (candidates, tmpl, first_arg, arglist, nargs, NULL,
+ access_path, conversion_path, 0);
}
}
/* The CANDS are the set of candidates that were considered for
- overload resolution. Return the set of viable candidates. If none
- of the candidates were viable, set *ANY_VIABLE_P to true. STRICT_P
- is true if a candidate should be considered viable only if it is
- strictly viable. */
+ overload resolution. Return the set of viable candidates, or CANDS
+ if none are viable. If any of the candidates were viable, set
+ *ANY_VIABLE_P to true. STRICT_P is true if a candidate should be
+ considered viable only if it is strictly viable. */
static struct z_candidate*
splice_viable (struct z_candidate *cands,
static inline int
equal_functions (tree fn1, tree fn2)
{
+ if (TREE_CODE (fn1) != TREE_CODE (fn2))
+ return 0;
+ if (TREE_CODE (fn1) == TEMPLATE_DECL)
+ return fn1 == fn2;
if (DECL_LOCAL_FUNCTION_P (fn1) || DECL_LOCAL_FUNCTION_P (fn2)
|| DECL_EXTERN_C_FUNCTION_P (fn1))
return decls_match (fn1, fn2);
inform (input_location, "%s %T <conversion>", msgstr, candidate->fn);
else if (candidate->viable == -1)
inform (input_location, "%s %+#D <near match>", msgstr, candidate->fn);
- else if (DECL_DELETED_FN (candidate->fn))
+ else if (DECL_DELETED_FN (STRIP_TEMPLATE (candidate->fn)))
inform (input_location, "%s %+#D <deleted>", msgstr, candidate->fn);
else
inform (input_location, "%s %+#D", msgstr, candidate->fn);
{
tree fn = cand1->fn;
/* Skip builtin candidates and conversion functions. */
- if (TREE_CODE (fn) != FUNCTION_DECL)
+ if (!DECL_P (fn))
continue;
cand2 = &cand1->next;
while (*cand2)
{
- if (TREE_CODE ((*cand2)->fn) == FUNCTION_DECL
+ if (DECL_P ((*cand2)->fn)
&& equal_functions (fn, (*cand2)->fn))
*cand2 = (*cand2)->next;
else
{
if (complain & tf_error)
{
- if (!any_viable_p && candidates && ! candidates->next)
+ if (!any_viable_p && candidates && ! candidates->next
+ && (TREE_CODE (candidates->fn) == FUNCTION_DECL))
return cp_build_function_call_vec (candidates->fn, args, complain);
if (TREE_CODE (fn) == TEMPLATE_ID_EXPR)
fn = TREE_OPERAND (fn, 0);
return cp_build_unary_op (code, arg1, candidates != 0, complain);
case ARRAY_REF:
- return build_array_ref (input_location, arg1, arg2);
+ return cp_build_array_ref (input_location, arg1, arg2, complain);
case MEMBER_REF:
return build_m_component_ref (cp_build_indirect_ref (arg1, RO_NULL,
< TYPE_PRECISION (double_type_node))
&& !DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (arg))))
arg = convert_to_real (double_type_node, arg);
- else if (TREE_CODE (TREE_TYPE (arg)) == NULLPTR_TYPE)
+ else if (NULLPTR_TYPE_P (TREE_TYPE (arg)))
arg = null_pointer_node;
else if (INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (arg)))
arg = perform_integral_promotions (arg);
}
/* [class.copy]: the copy constructor is implicitly defined even if
the implementation elided its use. */
- else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
+ else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn))
+ || move_fn_p (fn))
{
mark_used (fn);
already_used = true;
{
if (TREE_CODE (arg) == TARGET_EXPR)
return arg;
- else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
+ else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))
+ && !move_fn_p (fn))
return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
}
else if (TREE_CODE (arg) == TARGET_EXPR
/* This is not an error, it is runtime undefined
behavior. */
warning (0, (DECL_CONSTRUCTOR_P (current_function_decl) ?
- "abstract virtual %q#D called from constructor"
- : "abstract virtual %q#D called from destructor"),
+ "pure virtual %q#D called from constructor"
+ : "pure virtual %q#D called from destructor"),
fn);
if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE