fork download
  1. #include <iostream>
  2.  
  3. // Valid example:
  4. void foo(const int& x)
  5. {
  6. std::cout << x << std::endl;
  7. }
  8.  
  9. int main()
  10. {
  11. // legal; the temporary is bound to a const reference, so the compiler doesn't have to worry about foo() modifying it
  12. foo(7 * 6);
  13. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
42