X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gcc%2Fcp%2Fcall.c;h=5b3245ffa4e41c709542cadb5cbd81b11645a851;hb=0e69fdf016311cb8570c43d8ec67e9d5cb2f2aeb;hp=72394f4af60f6aed2c7aae8a95bfc7bf3b887d33;hpb=8d0d1915d9f96a4c9d9418b21b38cfa9c386d7a3;p=gcc.git diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 72394f4af60..5b3245ffa4e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5515,7 +5515,8 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, /* 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) @@ -5573,19 +5574,23 @@ build_op_delete_call (enum tree_code code, tree addr, tree size, 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; } @@ -6510,14 +6515,9 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) 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