From patchwork Fri Oct 12 08:31:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [C++,testcase] PR 52744 Date: Thu, 11 Oct 2012 22:31:57 -0000 From: Paolo Carlini X-Patchwork-Id: 191071 Message-Id: <5077D57D.5050505@oracle.com> To: "gcc-patches@gcc.gnu.org" Hi, testcase committed, PR closed as fixed in mainline. Tested x86_64-linux. Thanks, Paolo. //////////////////// 2012-10-12 Paolo Carlini PR c++/52744 * g++.dg/cpp0x/pr52744.C: New. Index: g++.dg/cpp0x/pr52744.C =================================================================== --- g++.dg/cpp0x/pr52744.C (revision 0) +++ g++.dg/cpp0x/pr52744.C (working copy) @@ -0,0 +1,83 @@ +// PR c++/52744 +// { dg-do compile { target c++11 } } + +struct T +{ + int a; + void b(){} + int c(int) + { + return 1; + } +}; + +template struct member_helper; + +template +struct member_helper +{ + static const char* worker() + { + return "for members"; + } +}; + +template +struct member_helper +{ + static const char* worker() + { + return "for member functions returning non void"; + } +}; + +template +struct member_helper +{ + static const char* worker() + { + return "for member functions returning void"; + } +}; + +void member_test() +{ + member_helper::worker(); + member_helper::worker(); + member_helper::worker(); +} + +typedef void lua_State; + +template class function_helper +{ + static_assert(sizeof(T) != sizeof(T), + "Error: function_helper works with functions (duh)"); +}; + +template +struct function_helper +{ + static int wrapper(lua_State* l) + { + return 1; + } +}; + +template +struct function_helper +{ + static int wrapper(lua_State* l) + { + return 0; + } +}; + +int ciao(int){ return 0; } +void ciao2(int){} + +void function_test() +{ + function_helper::wrapper(0); + function_helper::wrapper(0); +}