https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100032
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |8.5 CC| |jason at gcc dot gnu.org Summary|renaming alias template |[8/9/10/11 Regression] |that also adds |renaming alias template |cv-qualifiers is deemed |that also adds |equivalent to underlying |cv-qualifiers is deemed |template |equivalent to underlying | |template --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- We started accepting the testcase after r208152. I tried making get_underlying_template look through an alias only if the underlying type is unqualified: --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -6574,6 +6574,8 @@ get_underlying_template (tree tmpl) /* The underlying type may have been ill-formed. Don't proceed. */ if (!orig_type) break; + if (TYPE_QUALS (orig_type) != TYPE_UNQUALIFIED) + break; tree tinfo = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (orig_type); if (!tinfo) break; but this also makes us (incorrectly?) reject template <template<class> class> struct X { }; template <class> struct Y { }; template <class T> using Z = const Y<T>; template <class T> using W = Z<T>; using U = X<Z>; using U = X<W>; because the underlying type of W for some reason already has the const qualifier, so get_underlying_template(W) yields W and we deem W not equivalent to Z.