https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120655
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2025-06-18 --- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> --- Looks like this cppreference example is taken directly from the standard: https://wg21.link/over.match.class.deduct#example-2 so it's expected to work, one way or another, and it's unspecified what the signature of the guide should be. GCC has heuristics to strip such alias templates when it's definitely safe to do so, namely when the alias template uses all of its template parameters (and is not constrained)[1]. But here TA doesn't use its template parameter U, so we don't strip it, and instead form a dependently-scoped reference to it. Maybe we can extend the heuristic to also strip an alias template when each template parameter of the alias template is used, or if it's unused the corresponding template argument of the alias template-id is "simple". So in the example we would strip TA<U> to T, but not TA<typename U::type>. [1]: So the following version of the example is correctly accepted by GCC due to the heuristic: template<class T> struct B { template<class U> using TA = U; // TA uses its template parameter U, so we strip it when forming the guide for #1, allowing U to be deduced. template<class U> B(T, TA<U>); // #1 }; int main() { B b{(int*)0, (char*)0}; return 0; }