/* If the FN is a member function, make sure that it is
accessible. */
if (BASELINK_P (fns))
- perform_or_defer_access_check (BASELINK_BINFO (fns), fn, fn);
+ perform_or_defer_access_check (BASELINK_BINFO (fns), fn, fn,
+ complain);
/* Core issue 901: It's ok to new a type with deleted delete. */
if (DECL_DELETED_FN (fn) && alloc_fn)
the declaration to use in the error diagnostic. */
bool
-enforce_access (tree basetype_path, tree decl, tree diag_decl)
+enforce_access (tree basetype_path, tree decl, tree diag_decl,
+ tsubst_flags_t complain)
{
gcc_assert (TREE_CODE (basetype_path) == TREE_BINFO);
if (!accessible_p (basetype_path, decl, true))
{
- if (TREE_PRIVATE (decl))
- error ("%q+#D is private", diag_decl);
- else if (TREE_PROTECTED (decl))
- error ("%q+#D is protected", diag_decl);
- else
- error ("%q+#D is inaccessible", diag_decl);
- error ("within this context");
+ if (complain & tf_error)
+ {
+ if (TREE_PRIVATE (decl))
+ error ("%q+#D is private", diag_decl);
+ else if (TREE_PROTECTED (decl))
+ error ("%q+#D is protected", diag_decl);
+ else
+ error ("%q+#D is inaccessible", diag_decl);
+ error ("within this context");
+ }
return false;
}
access_fn = DECL_TI_TEMPLATE (fn);
else
access_fn = fn;
- if (flags & LOOKUP_SPECULATIVE)
- {
- if (!speculative_access_check (cand->access_path, access_fn, fn,
- complain & tf_error))
- return error_mark_node;
- }
- else
- perform_or_defer_access_check (cand->access_path, access_fn, fn);
+ if (!perform_or_defer_access_check (cand->access_path, access_fn,
+ fn, complain))
+ return error_mark_node;
}
/* If we're checking for implicit delete, don't bother with argument