fork download
  1. template<typename T>
  2. void f(T&) { return; }
  3.  
  4. int main(void)
  5. {
  6. f<const int>(5);
  7. f('c');
  8. f(6.2);
  9. }
  10.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:7:10: error: invalid initialization of non-const reference of type 'char&' from an rvalue of type 'char'
prog.cpp:2:6: error: in passing argument 1 of 'void f(T&) [with T = char]'
prog.cpp:8:10: error: invalid initialization of non-const reference of type 'double&' from an rvalue of type 'double'
prog.cpp:2:6: error: in passing argument 1 of 'void f(T&) [with T = double]'
stdout
Standard output is empty