fork download
  1. template <typename T = char>
  2. void myFunc(T x, T y, T z)
  3. {
  4. }
  5.  
  6. int main()
  7. {
  8. short x = 1;
  9. int y = 2;
  10. long z = 3;
  11.  
  12. myFunc(x, y, z);
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12:19: error: no matching function for call to ‘myFunc(short int&, int&, long int&)’
prog.cpp:12:19: note: candidate is:
prog.cpp:2:6: note: template<class T> void myFunc(T, T, T)
prog.cpp:2:6: note:   template argument deduction/substitution failed:
prog.cpp:12:19: note:   deduced conflicting types for parameter ‘T’ (‘short int’ and ‘int’)
stdout

Standard output is empty