https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54202
Serdar Sanli <mserdarsanli at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mserdarsanli at gmail dot com
--- Comment #9 from Serdar Sanli <mserdarsanli at gmail dot com> ---
A simpler example not involving any globals, causing Wfree-nonheap-object
warning since GCC11
https://godbolt.org/z/MYn1zrjE4
===
struct Foo {
void allocate(int n);
void deallocate();
int *_data;
};
void Foo::allocate(int n) {
_data = new int[n] - 1;
}
void Foo::deallocate() {
delete[] (_data+1);
}