fork download
  1. #include <iostream>
  2. struct Policy1
  3. {
  4. template<typename T>
  5. void Print(const T &msg)
  6. {
  7. std::cout << "1: " << msg << std::endl;
  8. }
  9. };
  10. struct Policy2
  11. {
  12. template<typename T>
  13. void Print(const T &msg)
  14. {
  15. std::cout << "2: " << msg << std::endl;
  16. }
  17. };
  18. template<typename Tpolicy = Policy1>
  19. class Client
  20. {
  21. public:
  22. static void Test()
  23. {
  24. Tpolicy::Print<short>(1);
  25. }
  26. }
  27. int main()
  28. {
  29. Client::Test();
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In static member function 'static void Client<Tpolicy>::Test()':
prog.cpp:24:24: error: expected primary-expression before 'short'
prog.cpp:24:24: error: expected ';' before 'short'
prog.cpp: At global scope:
prog.cpp:19:1: error: new types may not be defined in a return type
prog.cpp:19:1: note: (perhaps a semicolon is missing after the definition of 'Client<Tpolicy>')
prog.cpp:27:10: error: two or more data types in declaration of 'main'
stdout
Standard output is empty