https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91369
--- Comment #28 from Toni Neubert <lutztonineubert at gmail dot com> ---
Thank you very much again for your fast help. Your patch works for this test
case.
I have another test case which fails. (Maybe more..., I am sorry).
//main.cpp: in ‘constexpr’ expansion of ‘test3()’
//main.cpp: in ‘constexpr’ expansion of ‘(& b)->bar::~bar()’
//main.cpp: in ‘constexpr’ expansion of ‘(&((bar*)this)->bar::f)->foo::~foo()’
//main.cpp error: deallocation of already deallocated storage
struct foo {
constexpr foo(int* i) : ptr{i} {}
constexpr ~foo() {
delete ptr;
}
int* ptr;
};
struct bar {
foo f{new int};
};
constexpr auto test3() {
bar b;
return true;
}
static_assert(test3());