fork download
  1. #include <iostream>
  2.  
  3. struct Thing {
  4. operator int() const { return 0; }
  5. } thingy;
  6.  
  7. template <typename T>
  8. void print(T l, T r) { std::cout << l << " " << r << "\n"; }
  9.  
  10. int main() {
  11. int i = 0;
  12. print(i, thingy);
  13. return 0;
  14. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:12:17: error: no matching function for call to ‘print(int&, Thing&)’
  print(i, thingy);
                 ^
prog.cpp:12:17: note: candidate is:
prog.cpp:8:6: note: template<class T> void print(T, T)
 void print(T l, T r) { std::cout << l << " " << r << "\n"; }
      ^
prog.cpp:8:6: note:   template argument deduction/substitution failed:
prog.cpp:12:17: note:   deduced conflicting types for parameter ‘T’ (‘int’ and ‘Thing’)
  print(i, thingy);
                 ^
stdout
Standard output is empty