fork download
  1. #include <iostream>
  2. class cla {
  3. public:
  4. int *data;
  5. cla() {
  6. data = new int;
  7. }
  8. ~cla() {
  9. delete data;
  10. }
  11. cla ret() {
  12. cla tem ;
  13. *(tem.data) = 123;
  14. return tem;
  15. }
  16. };
  17. int main()
  18. {
  19. cla obj;
  20. obj = obj.ret();
  21. }
Runtime error #stdin #stdout #stderr 0s 4536KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
free(): double free detected in tcache 2