Skip to content

Conversation

stbergmann
Copy link
Contributor

...which avoids overload resolution ambiguities in C++20, when a synthesized
candidate of operator == for a reversed-argument rewrite conflicts with the
actual operator ==, as one is a template specialization for int and the other
for float. (As observed with recent Clang 10 trunk with -std=c++2a when
building libstaroffice as part of LibreOffice:

STOFFChart.cxx:230:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2') and 'STOFFVec2i' (aka 'STOFFVec2'))
bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
~~~~~~~~~~~^ ~~~~~~~~~~~~
./libstaroffice_internal.hxx:687:8: note: candidate function
bool operator==(STOFFVec2 const &p) const
^
./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)
STOFFChart.cxx:270:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2') and 'STOFFVec2i' (aka 'STOFFVec2'))
bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
~~~~~~~~~~~^ ~~~~~~~~~~~~
./libstaroffice_internal.hxx:687:8: note: candidate function
bool operator==(STOFFVec2 const &p) const
^
./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)

)

...which avoids overload resolution ambiguities in C++20, when a synthesized
candidate of operator == for a reversed-argument rewrite conflicts with the
actual operator ==, as one is a template specialization for int and the other
for float.  (As observed with recent Clang 10 trunk with -std=c++2a when
building libstaroffice as part of LibreOffice:

> STOFFChart.cxx:230:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
>     bool autoPlace=m_legendPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
>                                                    ~~~~~~~~~~~^ ~~~~~~~~~~~~
> ./libstaroffice_internal.hxx:687:8: note: candidate function
>   bool operator==(STOFFVec2<T> const &p) const
>        ^
> ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)
> STOFFChart.cxx:270:63: error: use of overloaded operator '==' is ambiguous (with operand types 'STOFFVec2f' (aka 'STOFFVec2<float>') and 'STOFFVec2i' (aka 'STOFFVec2<int>'))
>   bool autoPlace=m_plotAreaPosition==STOFFBox2f()||m_dimension==STOFFVec2i();
>                                                    ~~~~~~~~~~~^ ~~~~~~~~~~~~
> ./libstaroffice_internal.hxx:687:8: note: candidate function
>   bool operator==(STOFFVec2<T> const &p) const
>        ^
> ./libstaroffice_internal.hxx:687:8: note: candidate function (with reversed parameter order)

)
Copy link
Owner

@fosnola fosnola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 75c43a0

@fosnola fosnola closed this Nov 22, 2019
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

Successfully merging this pull request may close these issues.

2 participants