[Bug c++/91369] Implement P0784R7: constexpr new
lutztonineubert at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 3 14:33:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91369
--- Comment #25 from Toni Neubert <lutztonineubert at gmail dot com> ---
I get: "deallocation of already deallocated storage" for test2() but compiling
just test1() or test2() is just fine.
struct a {
constexpr a(int* i) : i{i} {
}
constexpr ~a() {
delete[] i;
}
int* i;
};
constexpr a make_a(int size) {
return {new int[size]()};
}
constexpr bool test1() {
make_a(1);
return true;
}
constexpr bool test2() {
make_a(1);
return true;
}
static_assert(test1());
static_assert(test2());
More information about the Gcc-bugs
mailing list