[Bug c++/105265] temporary object not destructed causing memory leaks

2022-04-13 Thread jack.cui2 at foxmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105265 --- Comment #2 from jack --- Additional info: g++8.4 and clang++ 3.8 have no such issue

[Bug c++/105265] temporary object not destructed causing memory leaks

2022-04-13 Thread jack.cui2 at foxmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105265 --- Comment #1 from jack --- #include using namespace std; class Block { public: Block(int n) : data{new char[n]}, size{n} { cout << "Block ctor\n"; } ~Block() { cout << "Block dtor\n"; delete[] da