* decl.c (make_typename_type): s/parameters/arguments/.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp0x / pr52744.C
blob1a01fb2957f307d26d6680e0f46d1e5784ac7852
1 // PR c++/52744
2 // { dg-do compile { target c++11 } }
4 struct T
6   int a;
7   void b(){}
8   int c(int)
9   {
10     return 1;
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()
20   {
21     return "for members";
22   }
25 template<typename Return, typename... Args, Return(T::*fun)(Args...)>
26 struct member_helper<Return(T::*)(Args...), fun>
28   static const char* worker()
29   {
30     return "for member functions returning non void";
31   }
34 template<typename... Args, void(T::*fun)(Args...)>
35 struct member_helper<void(T::*)(Args...), fun>
37   static const char* worker()
38   {
39     return "for member functions returning void";
40   }
43 void member_test()
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)
62   {
63     return 1;
64   }
67 template<typename... Args, void(*func)(Args...)>
68 struct function_helper<void(*)(Args...), func>
70   static int wrapper(lua_State* l)
71   {
72     return 0;
73   }
76 int ciao(int){ return 0; }
77 void ciao2(int){}
79 void function_test()
81   function_helper<decltype(&ciao), &ciao>::wrapper(0);
82   function_helper<decltype(&ciao2), &ciao2>::wrapper(0);