/* Subroutine of build_new_op: Add to CANDIDATES all candidates for the
operator indicated by CODE/CODE2. This function calls itself recursively to
- handle C++20 rewritten comparison operator candidates.
+ handle C++20 rewritten comparison operator candidates. Returns NULL_TREE
+ upon success, and error_mark_node if something went wrong that prevented
+ us from performing overload resolution (e.g. ambiguous member name lookup).
LOOKUPS, if non-NULL, is the set of pertinent namespace-scope operator
overloads to consider. This parameter is used when instantiating a
if (rewrite_code)
{
+ tree r;
flags |= LOOKUP_REWRITTEN;
if (rewrite_code != code)
- /* Add rewritten candidates in same order. */
- add_operator_candidates (candidates, rewrite_code, ERROR_MARK,
- arglist, lookups, flags, complain);
+ {
+ /* Add rewritten candidates in same order. */
+ r = add_operator_candidates (candidates, rewrite_code, ERROR_MARK,
+ arglist, lookups, flags, complain);
+ if (r == error_mark_node)
+ return error_mark_node;
+ }
z_candidate *save_cand = *candidates;
vec<tree,va_gc> *revlist = make_tree_vector ();
revlist->quick_push ((*arglist)[1]);
revlist->quick_push ((*arglist)[0]);
- add_operator_candidates (candidates, rewrite_code, ERROR_MARK,
- revlist, lookups, flags, complain);
+ r = add_operator_candidates (candidates, rewrite_code, ERROR_MARK,
+ revlist, lookups, flags, complain);
+ if (r == error_mark_node)
+ return error_mark_node;
/* Release the vec if we didn't add a candidate that uses it. */
for (z_candidate *c = *candidates; c != save_cand; c = c->next)