https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87452

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced a bit more:

struct vector { };

namespace N {

void operator+(const vector&) { }

template<typename T>
auto
f(const T& t)
-> decltype(operator+(t)) // OK
{
  return (+t);
}

template<typename T>
auto
g(const T& t)
-> decltype(+t) // fails to find operator defined in N::
{
  return (+t);
}

} // namespace N

int main()
{
  vector vec;
  N::f(vec);
  N::g(vec);
}

It works if struct vector and the operator+ overload are in the same namespace,
suggesting the operator can found via ADL, but normal lookup seems to not
consider namespace N.

Reply via email to