fork(1) download
  1. #include <iostream>
  2. #include <limits>
  3. #include <cstdint>
  4. using namespace std;
  5.  
  6. template<class T>
  7. T ala(T&& x) {
  8. x += 1;
  9. return x;
  10. }
  11.  
  12.  
  13. int main() {
  14. int& x = 10;
  15. cout << ala(x) << " " << x << endl;
  16. return 0;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:14:11: error: invalid initialization of non-const reference of type ‘int&’ from an rvalue of type ‘int’
  int& x = 10;
           ^~
stdout
Standard output is empty