fork download
  1. #include <iostream>
  2.  
  3. class TestUBClass
  4. {
  5. public:
  6. TestUBClass()
  7. {
  8. std::cout << "TestUBClass()" << std::endl;
  9. }
  10. TestUBClass(const TestUBClass& other)
  11. {
  12. std::cout << "TestUBClass(const TestUBClass& other)" << std::endl;
  13. }
  14. TestUBClass(TestUBClass&& other)
  15. {
  16. std::cout << "TestUBClass(TestUBClass&& other)" << std::endl;
  17. }
  18. TestUBClass& operator=(const TestUBClass& other)
  19. {
  20. std::cout << "TestUBClass& operator=(const TestUBClass& other)" << std::endl;
  21. }
  22. TestUBClass& operator=(TestUBClass&& other)
  23. {
  24. std::cout << "TestUBClass& operator=(TestUBClass&& other)" << std::endl;
  25. }
  26. ~TestUBClass()
  27. {
  28. std::cout << "~TestUBClass()" << std::endl;
  29. }
  30. };
  31.  
  32. void testUBFunc()
  33. {
  34. TestUBClass obj;
  35. delete &obj;
  36. }
  37.  
  38. int main() {
  39. testUBFunc();
  40. return 0;
  41. }
Runtime error #stdin #stdout #stderr 0s 80768KB
stdin
Standard input is empty
stdout
TestUBClass()
~TestUBClass()
stderr
*** Error in `./prog': free(): invalid pointer: 0x00007ffca8be44af ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x2b1933712bcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x2b1933718f96]
/lib/x86_64-linux-gnu/libc.so.6(+0x7778e)[0x2b193371978e]
./prog(+0xc48)[0x2b19327bfc48]
./prog(+0xa19)[0x2b19327bfa19]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x2b19336c22b1]
./prog(+0xa7a)[0x2b19327bfa7a]
======= Memory map: ========
2b19327bf000-2b19327c0000 r-xp 00000000 fd:00 24514566                   /home/etNicE/prog
2b19327c0000-2b19327c4000 rw-p 00000000 00:00 0 
2b19327cd000-2b19327d2000 rw-p 00000000 00:00 0 
2b19329c0000-2b19329c1000 r--p 00001000 fd:00 24514566                   /home/etNicE/prog
2b19329c1000-2b19329c2000 rw-p 00002000 fd:00 24514566                   /home/etNicE/prog
2b19329c2000-2b19329e5000 r-xp 00000000 fd:00 6073359                    /lib/x86_64-linux-gnu/ld-2.24.so
2b1932be5000-2b1932be6000 r--p 00023000 fd:00 6073359                    /lib/x86_64-linux-gnu/ld-2.24.so
2b1932be6000-2b1932be7000 rw-p 00024000 fd:00 6073359                    /lib/x86_64-linux-gnu/ld-2.24.so
2b1932be7000-2b1932be8000 rw-p 00000000 00:00 0 
2b1932be8000-2b1932d5a000 r-xp 00000000 fd:00 7235085                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
2b1932d5a000-2b1932f5a000 ---p 00172000 fd:00 7235085                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
2b1932f5a000-2b1932f64000 r--p 00172000 fd:00 7235085                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
2b1932f64000-2b1932f66000 rw-p 0017c000 fd:00 7235085                    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
2b1932f66000-2b1932f6a000 rw-p 00000000 00:00 0 
2b1932f6a000-2b193306d000 r-xp 00000000 fd:00 6073388                    /lib/x86_64-linux-gnu/libm-2.24.so
2b193306d000-2b193326c000 ---p 00103000 fd:00 6073388                    /lib/x86_64-linux-gnu/libm-2.24.so
2b193326c000-2b193326d000 r--p 00102000 fd:00 6073388                    /lib/x86_64-linux-gnu/libm-2.24.so
2b193326d000-2b193326e000 rw-p 00103000 fd:00 6073388                    /lib/x86_64-linux-gnu/libm-2.24.so
2b193326e000-2b1933284000 r-xp 00000000 fd:00 6073326                    /lib/x86_64-linux-gnu/libgcc_s.so.1
2b1933284000-2b1933483000 ---p 00016000 fd:00 6073326                    /lib/x86_64-linux-gnu/libgcc_s.so.1
2b1933483000-2b1933484000 r--p 00015000 fd:00 6073326                    /lib/x86_64-linux-gnu/libgcc_s.so.1
2b1933484000-2b1933485000 rw-p 00016000 fd:00 6073326                    /lib/x86_64-linux-gnu/libgcc_s.so.1
2b1933485000-2b193349d000 r-xp 00000000 fd:00 6073345                    /lib/x86_64-linux-gnu/libpthread-2.24.so
2b193349d000-2b193369c000 ---p 00018000 fd:00 6073345                    /lib/x86_64-linux-gnu/libpthread-2.24.so
2b193369c000-2b193369d000 r--p 00017000 fd:00 6073345                    /lib/x86_64-linux-gnu/libpthread-2.24.so
2b193369d000-2b193369e000 rw-p 00018000 fd:00 6073345                    /lib/x86_64-linux-gnu/libpthread-2.24.so
2b193369e000-2b19336a2000 rw-p 00000000 00:00 0 
2b19336a2000-2b1933837000 r-xp 00000000 fd:00 6073482                    /lib/x86_64-linux-gnu/libc-2.24.so
2b1933837000-2b1933a36000 ---p 00195000 fd:00 6073482                    /lib/x86_64-linux-gnu/libc-2.24.so
2b1933a36000-2b1933a3a000 r--p 00194000 fd:00 6073482                    /lib/x86_64-linux-gnu/libc-2.24.so
2b1933a3a000-2b1933a3c000 rw-p 00198000 fd:00 6073482                    /lib/x86_64-linux-gnu/libc-2.24.so
2b1933a3c000-2b1933a40000 rw-p 00000000 00:00 0 
2b1934385000-2b19343b7000 rw-p 00000000 00:00 0                          [heap]
2b1938000000-2b1938021000 rw-p 00000000 00:00 0 
2b1938021000-2b193c000000 ---p 00000000 00:00 0 
7ffca8bc4000-7ffca8be5000 rw-p 00000000 00:00 0                          [stack]
7ffca8bfa000-7ffca8bfc000 r-xp 00000000 00:00 0                          [vdso]
7ffca8bfc000-7ffca8bfe000 r--p 00000000 00:00 0                          [vvar]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]