1// PR c++/42447 2 3template<int> 4 void* get(int); 5 6template<typename> 7 struct unique_ptr; 8 9template<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 21template <typename T> class dynamic_dispatch; 22 23template <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 38template <typename TC> 39 class request_dispatcher 40 : private dynamic_dispatch<void (TC::*)(int&)> 41 { request_dispatcher(); }; 42 43struct file_reader 44{ 45 void execute_command(int&); 46}; 47 48template <> 49 request_dispatcher<file_reader>::request_dispatcher() 50 { this->attach_handler(&file_reader::execute_command); } 51