[Bug c++/104733] [12 Regression] Likely rejects valid since r12-6022-gbb2a7f80a98de3fe
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 1 15:10:34 GMT 2022
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.
More information about the Gcc-bugs
mailing list