https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122609
--- Comment #3 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
This also affects e.g. the search for operator!= in add_candidates when
attempting to discover if we can rewrite an operator== call. E.g.:
// a.cpp
export module M;
export struct S {};
export bool operator==(S, int);
bool operator!=(S, int); // not exported
export template <typename T> void foo(T t) { t == S{}; }
// b.cpp
import M;
int main() {
foo(123);
}
This should error, as the operator!= is visible in the instantiation context
and so the operator== is not a rewrite candidate
(https://eel.is/c++draft/over.match.oper#4), but currently compiles and emits a
call to the operator== with arguments reversed.