Since my fix for 53563, we were ignoring alias templates when looking
for a type template name. Fixed thus.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit d46136fac2f8b4b126d498031b4bb02a23d5738a
Author: Jason Merrill <ja...@redhat.com>
Date: Fri Jul 6 09:21:51 2012 -0400
PR c++/53858
* name-lookup.c (ambiguous_decl): Use DECL_TYPE_TEMPLATE_P.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index cc8439c..97581d9 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4059,7 +4059,7 @@ ambiguous_decl (struct scope_binding *old, cxx_binding *new_binding, int flags)
/* If we expect types or namespaces, and not templates,
or this is not a template class. */
if ((LOOKUP_QUALIFIERS_ONLY (flags)
- && !DECL_CLASS_TEMPLATE_P (val)))
+ && !DECL_TYPE_TEMPLATE_P (val)))
val = NULL_TREE;
break;
case TYPE_DECL:
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-20.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-20.C
new file mode 100644
index 0000000..078d257
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-20.C
@@ -0,0 +1,9 @@
+// PR c++/53858
+// { dg-do compile { target c++11 } }
+
+template <typename T> struct s0 { typedef T tdef0; };
+template <typename T> struct s1 { typedef T tdef1; };
+template <typename T> using us1 = typename s1<T>::tdef1;
+template <typename T, typename TT = typename us1<T>::tdef0> struct s2 {};
+
+int main () { return 0; }
commit 41eec657beceaa04ecbd7a459f2e9a42ef878173
Author: Jason Merrill <ja...@redhat.com>
Date: Fri Jul 6 09:22:38 2012 -0400
* cp-tree.h (DECL_DECLARES_TYPE_P): Check DECL_TYPE_TEMPLATE_P.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 0b2b234..713001e 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3704,7 +3704,7 @@ more_aggr_init_expr_args_p (const aggr_init_expr_arg_iterator *iter)
/* Nonzero for a NODE which declares a type. */
#define DECL_DECLARES_TYPE_P(NODE) \
- (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE))
+ (TREE_CODE (NODE) == TYPE_DECL || DECL_TYPE_TEMPLATE_P (NODE))
/* Nonzero if NODE declares a function. */
#define DECL_DECLARES_FUNCTION_P(NODE) \