OSDN Git Service

/cp
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / crash21.C
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
8 template <typename> struct B { 
9     B() throw() {} 
10     struct S { }; 
11     static int i; 
12     typedef unsigned short int dummy; 
13 }; 
14  
15 template <typename _Tp> 
16 struct allocator: B<_Tp> { 
17     template<typename _Tp1> struct rebind 
18     { typedef allocator<_Tp1> other; }; 
19 }; 
20  
21 template<typename T, typename> 
22 struct X { 
23     typename allocator<T>::template rebind<int>::other i; 
24     typedef int* dummy; 
25 }; 
26  
27 template <class T> class A { 
28     typedef typename X<T,allocator<T> >::dummy dummy; 
29     template <class TP> class XWrapper; 
30 }; 
31  
32  
33 template <class T> 
34 template <class TP> struct A<T>::XWrapper<TP *> 
35
36     XWrapper() {} 
37     X<int,allocator<int> > x; 
38 }; 
39  
40 template class A<int>::XWrapper<int *>;