1// { dg-do compile }
2
3// Origin: Debian GCC maintainers <debian-gcc@lists.debian.org>
4//	   Wolfgang Bangerth <bangerth@dealii.org>
5
6// PR c++/16706: Dependent type calculation during access checking
7
8template <typename> struct B {
9    B() throw() {}
10    struct S { };
11    static int i;
12    typedef unsigned short int dummy;
13};
14
15template <typename _Tp>
16struct allocator: B<_Tp> {
17    template<typename _Tp1> struct rebind
18    { typedef allocator<_Tp1> other; };
19};
20
21template<typename T, typename>
22struct X {
23    typename allocator<T>::template rebind<int>::other i;
24    typedef int* dummy;
25};
26
27template <class T> class A {
28    typedef typename X<T,allocator<T> >::dummy dummy;
29    template <class TP> class XWrapper;
30};
31
32
33template <class T>
34template <class TP> struct A<T>::XWrapper<TP *>
35{
36    XWrapper() {}
37    X<int,allocator<int> > x;
38};
39
40template class A<int>::XWrapper<int *>;
41