re PR c++/42447 (ICE during processing complex templates)
[gcc.git] / gcc / testsuite / g++.dg / template / array21.C
1 // PR c++/42447
2
3 template<int>
4 void* get(int);
5
6 template<typename>
7 struct unique_ptr;
8
9 template<typename _Tp>
10 struct unique_ptr<_Tp[]>
11 {
12 typedef int __tuple_type;
13
14 void*
15 get() const
16 { return ::get<0>(_M_t); }
17
18 __tuple_type _M_t;
19 };
20
21 template <typename T> class dynamic_dispatch;
22
23 template <typename TC>
24 struct dynamic_dispatch<void (TC::*)(int&)>
25 {
26 struct entry { };
27 unique_ptr<entry[]> m_Start;
28
29 template <typename UC>
30 void attach_handler(void (UC::*m)(int&))
31 {
32 entry* p = 0;
33 do {
34 } while(--p != m_Start.get());
35 }
36 };
37
38 template <typename TC>
39 class request_dispatcher
40 : private dynamic_dispatch<void (TC::*)(int&)>
41 { request_dispatcher(); };
42
43 struct file_reader
44 {
45 void execute_command(int&);
46 };
47
48 template <>
49 request_dispatcher<file_reader>::request_dispatcher()
50 { this->attach_handler(&file_reader::execute_command); }