#include <iostream>
using namespace std;
template < class S> class Foo;
template < class Ret, class Arg, class ... Args >
class Foo< Ret( Arg* , Args...) >
{
public :
template < class FUNC>
Foo( FUNC func, int )
{
cout << "func" << endl;
}
template < class Rett>
Foo( Rett( Arg:: * method) ( Args...) ) { cout << "fptr" << endl; }
} ;
void Bar( int * , int )
{
}
int main( )
{
Foo< void ( int * , int ) > fff( & Bar, 1 ) ;
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0ZW1wbGF0ZTxjbGFzcyBTPiBjbGFzcyBGb287Cgp0ZW1wbGF0ZTxjbGFzcyBSZXQsIGNsYXNzIEFyZywgY2xhc3MuLi4gQXJncz4KY2xhc3MgRm9vPFJldChBcmcqLCBBcmdzLi4uKT4gCnsKcHVibGljOgoJdGVtcGxhdGU8Y2xhc3MgRlVOQz4KCUZvbyhGVU5DIGZ1bmMsIGludCkKCXsKCQljb3V0IDw8ICJmdW5jIiA8PCBlbmRsOwoJfQoJdGVtcGxhdGU8Y2xhc3MgUmV0dD4KCUZvbyhSZXR0KEFyZzo6Km1ldGhvZCkoQXJncy4uLikpIHsgY291dCA8PCAiZnB0ciIgPDwgZW5kbDsgfQoJCn07Cgp2b2lkIEJhcihpbnQqLCBpbnQpCnsKCn0KCmludCBtYWluKCkKewoJCglGb288dm9pZChpbnQqLCBpbnQpPiBmZmYoJkJhciwgMSk7CgoJcmV0dXJuIDA7Cn0K
compilation info
prog.cpp: In instantiation of 'class Foo<void(int*, int)>':
prog.cpp:27:26: required from here
prog.cpp:15:2: error: creating pointer to member function of non-class type 'int'
Foo(Rett(Arg::*method)(Args...)) { cout << "fptr" << endl; }
^
stdout