1 // PR c++/66647
2 // { dg-do compile { target c++11 } }
3 
4 template <typename _Tp> struct A
5 {
6   static constexpr _Tp value = 1;
7 };
8 template <typename> class B
9 {
10 public:
11   template <typename> struct rebind
12   {
13   };
14 };
15 
16 template <typename _Alloc, typename _Tp> class C
17 {
18   template <typename _Alloc2, typename _Tp2>
19   static A<int> _S_chk (typename _Alloc2::template rebind<_Tp2> *);
20 
21 public:
22   using __type = decltype (_S_chk<_Alloc, _Tp> (0));
23 };
24 
25 template <typename _Alloc, typename _Tp, int = C<_Alloc, _Tp>::__type::value>
26 struct D;
27 template <typename _Alloc, typename _Tp> struct D<_Alloc, _Tp, 1>
28 {
29   typedef typename _Alloc::template rebind<_Tp> __type;
30 };
31 template <typename _Alloc> struct F
32 {
33   template <typename _Tp> using rebind_alloc = typename D<_Alloc, _Tp>::__type;
34 };
35 template <typename _Alloc> struct __alloc_traits
36 {
37   template <typename> struct rebind
38   {
39     typedef typename F<_Alloc>::template rebind_alloc<int> other;
40   };
41 };
42 template <typename _Alloc> struct G
43 {
44   typename __alloc_traits<_Alloc>::template rebind<int>::other _Tp_alloc_type;
45 };
46 template <typename _Tp, typename _Alloc = B<_Tp> > class vector : G<_Alloc>
47 {
48 };
49 
50 template <int> using tfuncptr = void();
51 template <int d> struct H
52 {
53   vector<tfuncptr<d> > funcs;
54 };
55