1// { dg-do assemble  }
2// Origin: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
3
4// Bug 29.  We failed to verify that template argument deduction
5// produces a valid result in nondeduce context.
6
7template<class T> struct Y { typedef T X; };
8
9template<class T, class U> struct Base {};
10
11template<class T> struct Base<T, typename T::X> {};
12
13template<class T> struct Base<typename T::X, T> {};
14
15template<class T, class U> struct Derived : Base <T, U> {};
16
17struct A {};
18
19template<class T> struct Derived<A, T> : Base< Y<T>, Y<T> > {};
20
21int main()
22{
23  Derived<A, int> d;
24}
25