2 // { dg-do compile { target c++11 } }
14 template<typename CT, CT> struct member_helper;
16 template<typename FT, FT(T::*mem)>
17 struct member_helper<FT(T::*), mem>
19 static const char* worker()
25 template<typename Return, typename... Args, Return(T::*fun)(Args...)>
26 struct member_helper<Return(T::*)(Args...), fun>
28 static const char* worker()
30 return "for member functions returning non void";
34 template<typename... Args, void(T::*fun)(Args...)>
35 struct member_helper<void(T::*)(Args...), fun>
37 static const char* worker()
39 return "for member functions returning void";
45 member_helper<decltype(&T::a), &T::a>::worker();
46 member_helper<decltype(&T::b), &T::b>::worker();
47 member_helper<decltype(&T::c), &T::c>::worker();
50 typedef void lua_State;
52 template<typename T, T> class function_helper
54 static_assert(sizeof(T) != sizeof(T),
55 "Error: function_helper works with functions (duh)");
58 template<typename Return, typename... Args, Return(*func)(Args...)>
59 struct function_helper<Return(*)(Args...), func>
61 static int wrapper(lua_State* l)
67 template<typename... Args, void(*func)(Args...)>
68 struct function_helper<void(*)(Args...), func>
70 static int wrapper(lua_State* l)
76 int ciao(int){ return 0; }
81 function_helper<decltype(&ciao), &ciao>::wrapper(0);
82 function_helper<decltype(&ciao2), &ciao2>::wrapper(0);