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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
The problem is that we don't preserve the unqualified lookup in our template
representation of operator expressions the way we do for normal calls.  Here's
a variant that never worked, because we're instantiating the lambda call
operator out of its definition context:

struct bar {};

namespace foo
{
  void operator+(bar) {}
} // namespace foo                                                              

auto fn() {
  using namespace foo;
  return [](auto x) { +x;};
}

int main()
{
  auto l = fn();
  l(bar());
}

Reply via email to