Commit 988db853 by Paolo Carlini Committed by Paolo Carlini

class.c (resolve_address_of_overloaded_function, [...]): Rename tsubst_flags_t…

class.c (resolve_address_of_overloaded_function, [...]): Rename tsubst_flags_t parameter flags -> complain.

2015-04-16  Paolo Carlini  <paolo.carlini@oracle.com>

	* class.c (resolve_address_of_overloaded_function, instantiate_type):
	Rename tsubst_flags_t parameter flags -> complain.

From-SVN: r222159
parent 6e3957da
2015-04-16 Paolo Carlini <paolo.carlini@oracle.com> 2015-04-16 Paolo Carlini <paolo.carlini@oracle.com>
* class.c (resolve_address_of_overloaded_function, instantiate_type):
Rename tsubst_flags_t parameter flags -> complain.
2015-04-16 Paolo Carlini <paolo.carlini@oracle.com>
* call.c (build_op_delete_call, build_over_call): Check mark_used * call.c (build_op_delete_call, build_over_call): Check mark_used
return value. return value.
* class.c (resolve_address_of_overloaded_function): Likewise. * class.c (resolve_address_of_overloaded_function): Likewise.
......
...@@ -7471,7 +7471,7 @@ pop_lang_context (void) ...@@ -7471,7 +7471,7 @@ pop_lang_context (void)
static tree static tree
resolve_address_of_overloaded_function (tree target_type, resolve_address_of_overloaded_function (tree target_type,
tree overload, tree overload,
tsubst_flags_t flags, tsubst_flags_t complain,
bool template_only, bool template_only,
tree explicit_targs, tree explicit_targs,
tree access_path) tree access_path)
...@@ -7531,7 +7531,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7531,7 +7531,7 @@ resolve_address_of_overloaded_function (tree target_type,
target_type = build_reference_type (target_type); target_type = build_reference_type (target_type);
else else
{ {
if (flags & tf_error) if (complain & tf_error)
error ("cannot resolve overloaded function %qD based on" error ("cannot resolve overloaded function %qD based on"
" conversion to type %qT", " conversion to type %qT",
DECL_NAME (OVL_FUNCTION (overload)), target_type); DECL_NAME (OVL_FUNCTION (overload)), target_type);
...@@ -7667,7 +7667,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7667,7 +7667,7 @@ resolve_address_of_overloaded_function (tree target_type,
if (matches == NULL_TREE) if (matches == NULL_TREE)
{ {
/* There were *no* matches. */ /* There were *no* matches. */
if (flags & tf_error) if (complain & tf_error)
{ {
error ("no matches converting function %qD to type %q#T", error ("no matches converting function %qD to type %q#T",
DECL_NAME (OVL_CURRENT (overload)), DECL_NAME (OVL_CURRENT (overload)),
...@@ -7695,7 +7695,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7695,7 +7695,7 @@ resolve_address_of_overloaded_function (tree target_type,
if (match) if (match)
{ {
if (flags & tf_error) if (complain & tf_error)
{ {
error ("converting overloaded function %qD to type %q#T is ambiguous", error ("converting overloaded function %qD to type %q#T is ambiguous",
DECL_NAME (OVL_FUNCTION (overload)), DECL_NAME (OVL_FUNCTION (overload)),
...@@ -7717,11 +7717,11 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7717,11 +7717,11 @@ resolve_address_of_overloaded_function (tree target_type,
fn = TREE_PURPOSE (matches); fn = TREE_PURPOSE (matches);
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)
&& !(flags & tf_ptrmem_ok) && !flag_ms_extensions) && !(complain & tf_ptrmem_ok) && !flag_ms_extensions)
{ {
static int explained; static int explained;
if (!(flags & tf_error)) if (!(complain & tf_error))
return error_mark_node; return error_mark_node;
permerror (input_location, "assuming pointer to member %qD", fn); permerror (input_location, "assuming pointer to member %qD", fn);
...@@ -7742,7 +7742,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7742,7 +7742,7 @@ resolve_address_of_overloaded_function (tree target_type,
if (fn == NULL) if (fn == NULL)
return error_mark_node; return error_mark_node;
/* Mark all the versions corresponding to the dispatcher as used. */ /* Mark all the versions corresponding to the dispatcher as used. */
if (!(flags & tf_conv)) if (!(complain & tf_conv))
mark_versions_used (fn); mark_versions_used (fn);
} }
...@@ -7750,12 +7750,12 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7750,12 +7750,12 @@ resolve_address_of_overloaded_function (tree target_type,
determining conversion sequences, we should not consider the determining conversion sequences, we should not consider the
function used. If this conversion sequence is selected, the function used. If this conversion sequence is selected, the
function will be marked as used at this point. */ function will be marked as used at this point. */
if (!(flags & tf_conv)) if (!(complain & tf_conv))
{ {
/* Make =delete work with SFINAE. */ /* Make =delete work with SFINAE. */
if (DECL_DELETED_FN (fn) && !(flags & tf_error)) if (DECL_DELETED_FN (fn) && !(complain & tf_error))
return error_mark_node; return error_mark_node;
if (!mark_used (fn, flags) && !(flags & tf_error)) if (!mark_used (fn, complain) && !(complain & tf_error))
return error_mark_node; return error_mark_node;
} }
...@@ -7765,11 +7765,11 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7765,11 +7765,11 @@ resolve_address_of_overloaded_function (tree target_type,
if (DECL_FUNCTION_MEMBER_P (fn)) if (DECL_FUNCTION_MEMBER_P (fn))
{ {
gcc_assert (access_path); gcc_assert (access_path);
perform_or_defer_access_check (access_path, fn, fn, flags); perform_or_defer_access_check (access_path, fn, fn, complain);
} }
if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type)) if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
return cp_build_addr_expr (fn, flags); return cp_build_addr_expr (fn, complain);
else else
{ {
/* The target must be a REFERENCE_TYPE. Above, cp_build_unary_op /* The target must be a REFERENCE_TYPE. Above, cp_build_unary_op
...@@ -7783,7 +7783,7 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7783,7 +7783,7 @@ resolve_address_of_overloaded_function (tree target_type,
/* This function will instantiate the type of the expression given in /* This function will instantiate the type of the expression given in
RHS to match the type of LHSTYPE. If errors exist, then return RHS to match the type of LHSTYPE. If errors exist, then return
error_mark_node. FLAGS is a bit mask. If TF_ERROR is set, then error_mark_node. COMPLAIN is a bit mask. If TF_ERROR is set, then
we complain on errors. If we are not complaining, never modify rhs, we complain on errors. If we are not complaining, never modify rhs,
as overload resolution wants to try many possible instantiations, in as overload resolution wants to try many possible instantiations, in
the hope that at least one will work. the hope that at least one will work.
...@@ -7792,16 +7792,16 @@ resolve_address_of_overloaded_function (tree target_type, ...@@ -7792,16 +7792,16 @@ resolve_address_of_overloaded_function (tree target_type,
function, or a pointer to member function. */ function, or a pointer to member function. */
tree tree
instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) instantiate_type (tree lhstype, tree rhs, tsubst_flags_t complain)
{ {
tsubst_flags_t flags_in = flags; tsubst_flags_t complain_in = complain;
tree access_path = NULL_TREE; tree access_path = NULL_TREE;
flags &= ~tf_ptrmem_ok; complain &= ~tf_ptrmem_ok;
if (lhstype == unknown_type_node) if (lhstype == unknown_type_node)
{ {
if (flags & tf_error) if (complain & tf_error)
error ("not enough type information"); error ("not enough type information");
return error_mark_node; return error_mark_node;
} }
...@@ -7819,7 +7819,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7819,7 +7819,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
; ;
else else
{ {
if (flags & tf_error) if (complain & tf_error)
error ("cannot convert %qE from type %qT to type %qT", error ("cannot convert %qE from type %qT to type %qT",
rhs, TREE_TYPE (rhs), fntype); rhs, TREE_TYPE (rhs), fntype);
return error_mark_node; return error_mark_node;
...@@ -7836,7 +7836,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7836,7 +7836,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
deduce any type information. */ deduce any type information. */
if (TREE_CODE (rhs) == NON_DEPENDENT_EXPR) if (TREE_CODE (rhs) == NON_DEPENDENT_EXPR)
{ {
if (flags & tf_error) if (complain & tf_error)
error ("not enough type information"); error ("not enough type information");
return error_mark_node; return error_mark_node;
} }
...@@ -7859,7 +7859,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7859,7 +7859,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
{ {
tree member = TREE_OPERAND (rhs, 1); tree member = TREE_OPERAND (rhs, 1);
member = instantiate_type (lhstype, member, flags); member = instantiate_type (lhstype, member, complain);
if (member != error_mark_node if (member != error_mark_node
&& TREE_SIDE_EFFECTS (TREE_OPERAND (rhs, 0))) && TREE_SIDE_EFFECTS (TREE_OPERAND (rhs, 0)))
/* Do not lose object's side effects. */ /* Do not lose object's side effects. */
...@@ -7871,7 +7871,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7871,7 +7871,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
case OFFSET_REF: case OFFSET_REF:
rhs = TREE_OPERAND (rhs, 1); rhs = TREE_OPERAND (rhs, 1);
if (BASELINK_P (rhs)) if (BASELINK_P (rhs))
return instantiate_type (lhstype, rhs, flags_in); return instantiate_type (lhstype, rhs, complain_in);
/* This can happen if we are forming a pointer-to-member for a /* This can happen if we are forming a pointer-to-member for a
member template. */ member template. */
...@@ -7885,7 +7885,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7885,7 +7885,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
tree args = TREE_OPERAND (rhs, 1); tree args = TREE_OPERAND (rhs, 1);
return return
resolve_address_of_overloaded_function (lhstype, fns, flags_in, resolve_address_of_overloaded_function (lhstype, fns, complain_in,
/*template_only=*/true, /*template_only=*/true,
args, access_path); args, access_path);
} }
...@@ -7893,7 +7893,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7893,7 +7893,7 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
case OVERLOAD: case OVERLOAD:
case FUNCTION_DECL: case FUNCTION_DECL:
return return
resolve_address_of_overloaded_function (lhstype, rhs, flags_in, resolve_address_of_overloaded_function (lhstype, rhs, complain_in,
/*template_only=*/false, /*template_only=*/false,
/*explicit_targs=*/NULL_TREE, /*explicit_targs=*/NULL_TREE,
access_path); access_path);
...@@ -7901,9 +7901,9 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags) ...@@ -7901,9 +7901,9 @@ instantiate_type (tree lhstype, tree rhs, tsubst_flags_t flags)
case ADDR_EXPR: case ADDR_EXPR:
{ {
if (PTRMEM_OK_P (rhs)) if (PTRMEM_OK_P (rhs))
flags |= tf_ptrmem_ok; complain |= tf_ptrmem_ok;
return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), flags); return instantiate_type (lhstype, TREE_OPERAND (rhs, 0), complain);
} }
case ERROR_MARK: case ERROR_MARK:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment