We also need to check that the cv-qualifiers are the same.
gcc/cp/ChangeLog:
PR c++/100032
* pt.c (get_underlying_template): Compare TYPE_QUALS.
gcc/testsuite/ChangeLog:
PR c++/100032
* g++.dg/cpp0x/alias-decl-equiv1.C: New test.
!= num_innermost_template_parms (underlying)))
break;
+ /* Does the alias add cv-quals? */
+ if (TYPE_QUALS (TREE_TYPE (underlying)) != TYPE_QUALS (TREE_TYPE (tmpl)))
+ break;
+
tree alias_args = INNERMOST_TEMPLATE_ARGS (generic_targs_for (tmpl));
if (!comp_template_args (TI_ARGS (tinfo), alias_args))
break;
--- /dev/null
+// PR c++/100032
+// { dg-do compile { target c++11 } }
+
+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>;
+
+using T = X<Y>;
+using T = X<Z>; // { dg-error "conflicting declaration" }