summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/template/array21.C
blob: 5c5f2f65d6b7be412c0f7ec75b6926a4e22eb8ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// PR c++/42447

template<int>
  void* get(int);

template<typename>
  struct unique_ptr;

template<typename _Tp>
  struct unique_ptr<_Tp[]>
  {
    typedef int __tuple_type;

    void*
    get() const
    { return ::get<0>(_M_t); }

    __tuple_type _M_t;
  };

template <typename T> class dynamic_dispatch;

template <typename TC>
  struct dynamic_dispatch<void (TC::*)(int&)>
  {
    struct entry { };
    unique_ptr<entry[]> m_Start;

    template <typename UC>
      void attach_handler(void (UC::*m)(int&))
      {
        entry* p = 0;
        do {
        } while(--p != m_Start.get());
      }
  };

template <typename TC>
  class request_dispatcher
  : private dynamic_dispatch<void (TC::*)(int&)>
  { request_dispatcher(); };

struct file_reader
{
  void execute_command(int&);
};

template <>
  request_dispatcher<file_reader>::request_dispatcher()
  { this->attach_handler(&file_reader::execute_command); }