https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94214
Bug ID: 94214 Summary: function lookup with overloaded operators accepts invalid Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: niklas at nolte dot dev Target Milestone: --- Sample code: ``` #include <vector> template <typename T> void blub(std::vector<T> const& i) { -i; //getsize(i); //this also fails in gcc } int operator-(std::vector<int> const& i) { return i.size(); } int getsize(std::vector<int> const& i) { return i.size(); } int main() { blub(std::vector<int>{1}); } ``` this shouldn't compile, it doesn't in clang.. See - https://godbolt.org/z/hgGeH3 - https://stackoverflow.com/questions/60740257/clang-vs-gcc-function-lookup-with-operator-overloads?noredirect=1#comment107466162_60740257 - https://stackoverflow.com/questions/58793092/two-phase-function-template-compilation-not-only-adl-is-employed-in-the-2nd-p