fork download
  1. #include <iostream>
  2.  
  3. template<typename T>
  4. T foo(T&& t)
  5. {
  6. return t;
  7. }
  8.  
  9. int main()
  10. {
  11. int a = 0;
  12. foo(a) = 42;
  13. std::cout << a << std::endl;
  14. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
42