fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class T>
  5. struct SingleFunc
  6. {
  7. T t;
  8. void run() { t(); }
  9. };
  10.  
  11. template <class... CompositeTypes>
  12. struct CompositeFunc
  13. {
  14.  
  15. };
  16.  
  17. struct Foo
  18. {
  19. void operator()()
  20. {
  21. cout << "!\n";
  22. }
  23. };
  24.  
  25. int main() {
  26.  
  27. SingleFunc<[](){std::cout<<"!\n"}> s;
  28.  
  29. s.run();
  30.  
  31. return 0;
  32. }
Compilation error #stdin compilation error #stdout 0s 3468KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:27:13: error: lambda-expression in template-argument
  SingleFunc<[](){std::cout<<"!\n"}> s;
             ^
prog.cpp:27:35: error: template argument 1 is invalid
  SingleFunc<[](){std::cout<<"!\n"}> s;
                                   ^
prog.cpp:29:4: error: request for member 'run' in 's', which is of non-class type 'int'
  s.run();
    ^
stdout
Standard output is empty