fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. void foo(int& refArg)
  6. {
  7. }
  8.  
  9. int bar()
  10. {
  11. return 5;
  12. }
  13.  
  14. int main()
  15. {
  16. foo(bar());
  17. return 0;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:16:9: error: cannot bind non-const lvalue reference of type ‘int&’ to an rvalue of type ‘int’
  foo(bar());
      ~~~^~
prog.cpp:5:6: note:   initializing argument 1 of ‘void foo(int&)’
 void foo(int& refArg)
      ^~~
stdout
Standard output is empty