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

--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW here's a reduction that Clang and GCC 11 accept, and trunk rejects:

template<class T, class U>
auto mul(T t, U u) -> decltype(t * u); // #1

namespace M { struct A { }; }

void operator*(M::A, M::A); // #2

template<class T, class U>
auto mul(T t, U u) -> decltype(t * u); // redeclaration of #1

int main() {
  M::A a;
  mul(a, a);
}

I believe this testcase is also invalid.  Despite the redeclaration of #1 (from
which #2 is visible), the result of unqualified lookup for 't * u' performed
from the original declaration (which doesn't see #2) should prevail according
to  wg21.link/cwg1321.

Reply via email to