// { dg-options "-std=gnu++0x" } #define ONE #define TWO #define THREE struct Something {}; Something ___; template struct Trial { F f; public: Trial() : f() {} Trial( const F& ff ) : f(ff) { } template struct Sig { typedef int ResultType; }; template struct Sig { typedef int ResultType; }; #ifdef ONE template typename Sig::ResultType operator()(const Something& s, const Args&... args) const { return f(args...); } #endif #ifdef TWO template typename Sig::ResultType operator()(const Args&... args) const { return f(args...); } #endif }; struct Internal { template struct Sig { typedef int ResultType; }; template struct Sig { typedef int ResultType; }; template int operator()(const Args&... args) const { int n = sizeof...(Args); return n; } static Trial& full() { static Trial f; return f; } }; static Trial& internal = Internal::full(); int main() { int n = 0; #ifdef ONE n = internal(___,1,2); #endif #ifdef THREE n = internal(___,1,2,3); n = internal(___,1,2,3,4); #endif return 0; }