fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct s{};
  5.  
  6.  
  7. void someFunction(s& value){
  8. std::cout << "ref" << std::endl;
  9. }
  10.  
  11. void someFunction(const s&& value){
  12. std::cout << "const" << std::endl;
  13. }
  14.  
  15. void someFunction(s&& value){
  16. std::cout << "non const" << std::endl;
  17. }
  18.  
  19. const s foo() { return s(); }
  20. s bar() { return s(); }
  21.  
  22.  
  23. int main() {
  24. someFunction(bar());
  25. someFunction(foo());
  26. return 0;
  27. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
non const
const