fork(1) download
  1. // A type templated for different function call signatures.
  2. template <typename Signature> class Used;
  3. template <typename T_Ret, typename ...T_Args>
  4. class Used<T_Ret(T_Args...)> {
  5. public:
  6. // A static method for a specific type.
  7. template <typename T>
  8. static void specific() { }
  9. };
  10.  
  11. // Some class using the above.
  12. template <typename T>
  13. class User {
  14. public:
  15. // A method that must call the specific function of used.
  16. template <typename T_Ret, typename ...T_Args>
  17. void method() {
  18. using It = Used<T_Ret(T_Args...)>;
  19. using Me = T;
  20. // error: expected primary-expression before '>' token
  21. It::specific<Me>();
  22. }
  23. };
  24.  
  25. int main() {
  26. User<int> user;
  27. user.method<void, int>();
  28. }
  29.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function 'void User<T>::method()':
prog.cpp:21:18: error: expected primary-expression before '>' token
   It::specific<Me>();
                  ^
prog.cpp:21:20: error: expected primary-expression before ')' token
   It::specific<Me>();
                    ^
stdout
Standard output is empty