fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void f(int arg1, int arg2) {}
  5. void f(int arg) {}
  6.  
  7. template<typename F, typename ...Args>
  8. void execution(F func, Args&&... args)
  9. {
  10. func(std::forward<Args>(args)...);
  11. }
  12.  
  13. int main()
  14. {
  15. execution(f, 1);
  16. execution(f, 1, 2);
  17.  
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:15:16: error: no matching function for call to ‘execution(<unresolved overloaded function type>, int)’
  execution(f, 1);
                ^
prog.cpp:15:16: note: candidate is:
prog.cpp:8:6: note: template<class F, class ... Args> void execution(F, Args&& ...)
 void execution(F func, Args&&... args)
      ^
prog.cpp:8:6: note:   template argument deduction/substitution failed:
prog.cpp:15:16: note:   couldn't deduce template parameter ‘F’
  execution(f, 1);
                ^
prog.cpp:16:19: error: no matching function for call to ‘execution(<unresolved overloaded function type>, int, int)’
  execution(f, 1, 2);
                   ^
prog.cpp:16:19: note: candidate is:
prog.cpp:8:6: note: template<class F, class ... Args> void execution(F, Args&& ...)
 void execution(F func, Args&&... args)
      ^
prog.cpp:8:6: note:   template argument deduction/substitution failed:
prog.cpp:16:19: note:   couldn't deduce template parameter ‘F’
  execution(f, 1, 2);
                   ^
stdout
Standard output is empty