禁止拷贝构造,禁止bug( 二 )

先不要看答案 , 大家可以思考下~
禁止拷贝构造,禁止bug文章插图
我们可以编译运行下 , 会出现什么现象:
root@iZuf67on1pthsuih96udyfZ:~/GDB/20201014# g++ -std=c++11 CopyConstruct.cpp root@iZuf67on1pthsuih96udyfZ:~/GDB/20201014# ./a.out *** Error in `./a.out': double free or corruption (fasttop): 0x000000000136ac20 ***======= Backtrace: =========/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fb1f13b97e5]/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fb1f13c237a]/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fb1f13c653c]./a.out[0x400caa]./a.out[0x400b7a]/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fb1f1362830]./a.out[0x400a19]======= Memory map: ========00400000-00401000 r-xp 00000000 fd:01 131851/root/GDB/20201014/a.out00601000-00602000 r--p 00001000 fd:01 131851/root/GDB/20201014/a.out00602000-00603000 rw-p 00002000 fd:01 131851/root/GDB/20201014/a.out01359000-0138b000 rw-p 00000000 00:00 0[heap]7fb1ec000000-7fb1ec021000 rw-p 00000000 00:00 0 7fb1ec021000-7fb1f0000000 ---p 00000000 00:00 0 7fb1f1039000-7fb1f1141000 r-xp 00000000 fd:01 925468/lib/x86_64-linux-gnu/libm-2.23.so7fb1f1141000-7fb1f1340000 ---p 00108000 fd:01 925468/lib/x86_64-linux-gnu/libm-2.23.so7fb1f1340000-7fb1f1341000 r--p 00107000 fd:01 925468/lib/x86_64-linux-gnu/libm-2.23.so7fb1f1341000-7fb1f1342000 rw-p 00108000 fd:01 925468/lib/x86_64-linux-gnu/libm-2.23.so7fb1f1342000-7fb1f1502000 r-xp 00000000 fd:01 925465/lib/x86_64-linux-gnu/libc-2.23.so7fb1f1502000-7fb1f1702000 ---p 001c0000 fd:01 925465/lib/x86_64-linux-gnu/libc-2.23.so7fb1f1702000-7fb1f1706000 r--p 001c0000 fd:01 925465/lib/x86_64-linux-gnu/libc-2.23.so7fb1f1706000-7fb1f1708000 rw-p 001c4000 fd:01 925465/lib/x86_64-linux-gnu/libc-2.23.so7fb1f1708000-7fb1f170c000 rw-p 00000000 00:00 0 7fb1f170c000-7fb1f1722000 r-xp 00000000 fd:01 918031/lib/x86_64-linux-gnu/libgcc_s.so.17fb1f1722000-7fb1f1921000 ---p 00016000 fd:01 918031/lib/x86_64-linux-gnu/libgcc_s.so.17fb1f1921000-7fb1f1922000 rw-p 00015000 fd:01 918031/lib/x86_64-linux-gnu/libgcc_s.so.17fb1f1922000-7fb1f1a94000 r-xp 00000000 fd:01 265161/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.217fb1f1a94000-7fb1f1c94000 ---p 00172000 fd:01 265161/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.217fb1f1c94000-7fb1f1c9e000 r--p 00172000 fd:01 265161/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.217fb1f1c9e000-7fb1f1ca0000 rw-p 0017c000 fd:01 265161/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.217fb1f1ca0000-7fb1f1ca4000 rw-p 00000000 00:00 0 7fb1f1ca4000-7fb1f1cca000 r-xp 00000000 fd:01 925451/lib/x86_64-linux-gnu/ld-2.23.so7fb1f1eb3000-7fb1f1eb9000 rw-p 00000000 00:00 0 7fb1f1ec8000-7fb1f1ec9000 rw-p 00000000 00:00 0 7fb1f1ec9000-7fb1f1eca000 r--p 00025000 fd:01 925451/lib/x86_64-linux-gnu/ld-2.23.so7fb1f1eca000-7fb1f1ecb000 rw-p 00026000 fd:01 925451/lib/x86_64-linux-gnu/ld-2.23.so7fb1f1ecb000-7fb1f1ecc000 rw-p 00000000 00:00 0 7ffdd4d0a000-7ffdd4d2b000 rw-p 00000000 00:00 0[stack]7ffdd4def000-7ffdd4df2000 r--p 00000000 00:00 0[vvar]7ffdd4df2000-7ffdd4df4000 r-xp 00000000 00:00 0[vdso]ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0[vsyscall]Abortedroot@iZuf67on1pthsuih96udyfZ:~/GDB/20201014#