https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122619
Bug ID: 122619
Summary: Memory leak when using g++15.2 with the -O2
optimization flag
Product: gcc
Version: 15.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jinwei.jpp at gmail dot com
Target Milestone: ---
Created attachment 62744
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62744&action=edit
The destructor of the object tuple_a is never called.
Hi.
There is a memory leak when using g++15.2 with the -O2 optimization flag .
Below is the code to reproduce the issue and the output log. compile use
-std=c++20, boost version is 1.89.
example code that reproduces the bug.The destructor of the object tuple_a is
never called.
The online compilation and running example is available at
https://godbolt.org/z/oncef5bfa
The log like:
-------------Begin TestLeak----------
BeginTest Loop====> 1
TestClassA_Tuple [this:0x5ec50f63d188][TestClassA_Tuple]
TestClassA_Value [this:0x5ec50f63d198][TestClassA_Value]
~TestClassA[this:0x5ec50f63d198][TestClassA_Value]
BeginTest Loop====> 2
TestClassA_Tuple [this:0x5ec50f63d188][TestClassA_Tuple]
TestClassA_Value [this:0x5ec50f63d198][TestClassA_Value]
~TestClassA[this:0x5ec50f63d198][TestClassA_Value]
------------- End TestLeak----------