Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wambiguous-reversed-operator #2554

Closed
ebraminio opened this issue Jul 8, 2020 · 0 comments
Closed

-Wambiguous-reversed-operator #2554

ebraminio opened this issue Jul 8, 2020 · 0 comments

Comments

@ebraminio
Copy link
Collaborator

ebraminio commented Jul 8, 2020

We get a -Wambiguous-reversed-operator warning in -std=c++2a mode in new clang builds, maybe an interesting thing or maybe not,

clang -c src/harfbuzz.cc src/hb-subset*.cc -DHB_NO_MT -Werror -std=c++2a

After the fix the warning can be removed from https://github.com/harfbuzz/harfbuzz/blob/5ea11cb/.circleci/config.yml#L121

src/hb-vector.hh:256:21: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'hb_user_data_array_t::hb_user_data_item_t' and 'hb_user_data_array_t::hb_user_data_item_t') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
      if (arrayZ[i] == v)
          ~~~~~~~~~ ^  ~
src/hb-object.hh:56:26: note: in instantiation of function template specialization 'hb_vector_t<hb_user_data_array_t::hb_user_data_item_t>::find<hb_user_data_array_t::hb_user_data_item_t>' requested here
    item_t *item = items.find (v);
                         ^
src/hb-static.cc:98:22: note: in instantiation of function template specialization 'hb_lockable_set_t<hb_user_data_array_t::hb_user_data_item_t, hb_mutex_t>::replace_or_insert<hb_user_data_array_t::hb_user_data_item_t>' requested here
  bool ret = !!items.replace_or_insert (item, lock, (bool) replace);
                     ^
src/hb-object.hh:172:10: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
    bool operator == (hb_user_data_item_t &other) const { return key == other.key; }
         ^
1 error generated.
@behdad behdad closed this as completed in 6a45df0 Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant