fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3. template<class S> class Foo;
  4.  
  5. template<class Ret, class Arg, class... Args>
  6. class Foo<Ret(Arg*, Args...)>
  7. {
  8. public:
  9. template<class FUNC>
  10. Foo(FUNC func, int)
  11. {
  12. cout << "func" << endl;
  13. }
  14. template<class Rett>
  15. Foo(Rett(Arg::*method)(Args...)) { cout << "fptr" << endl; }
  16.  
  17. };
  18.  
  19. template class Foo<void(int*, int)>;
  20.  
  21. int main()
  22. {
  23. return 0;
  24. }
  25.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In instantiation of 'class Foo<void(int*, int)>':
prog.cpp:19:16:   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
Standard output is empty