[Bug c++/100032] [8/9/10/11 Regression] renaming alias template that also adds cv-qualifiers is deemed equivalent to underlying template

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Apr 12 19:48:02 GMT 2021


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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-04-12
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #1)
> 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

Yes, because most alias templates are at least partly transparent, so W<T> has
the const added by Z<T>.  It should work to compare TYPE_QUALS to those of the
underlying template, rather than to TYPE_UNQUALIFIED.


More information about the Gcc-bugs mailing list