fork(8) download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <typename T> auto f(T x) -> decltype(x*x)
  6. {
  7. return x * x;
  8. }
  9.  
  10. template <typename T> T g(T x)
  11. {
  12. return x * x;
  13. }
  14.  
  15. template <template <class> class F> void test(F f)
  16. {
  17. auto a = f(32);
  18. auto b = f(' ');
  19. auto c = f(2000000000L);
  20.  
  21. cout << a << ' ' << b << ' ' << c << endl;
  22. }
  23.  
  24. int main()
  25. {
  26. test(f);
  27. test(g);
  28.  
  29. return 0;
  30. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:15:47: error: variable or field 'test' declared void
 template <template <class> class F> void test(F f)
                                               ^
prog.cpp:15:49: error: missing template arguments before 'f'
 template <template <class> class F> void test(F f)
                                                 ^
prog.cpp: In function 'int main()':
prog.cpp:26:8: error: 'test' was not declared in this scope
  test(f);
        ^
stdout
Standard output is empty