https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126194
--- Comment #1 from Dimitar Yordanov <dimitar.yordanov at sap dot com> ---
Cvise reduced:
// handle.hpp
struct A {
void *f_;
void **p_;
void destroy(void *, const void *, struct R &) const;
};
struct R {
virtual void deallocate(void *, const void *) ;
};
R &get_r();
struct B {
operator A() { return A(); }
};
void *operator new(decltype(sizeof(0)), A const &, R &);
void operator delete(void *, A const &, R &);
// handle.cpp
#include "handle.hpp"
R &get_r() {
}
__attribute__((noinline)) void A::destroy(void *p, const void *caller,
R &r) const {
*p_ = nullptr;
r.deallocate(p, caller);
}
void *operator new(decltype(sizeof(0)), A const &, R &) {
return 0;
}
__attribute__((noinline)) void operator delete(void *p, A const &a, R &r)
{
void *__trans_tmp_1 = __builtin_return_address(0);
a.destroy(p, __trans_tmp_1, r);
}
// main.cpp
#include "handle.hpp"
struct T {
T() {
throw 1;
}
};
R &make_widget_r = get_r();
__attribute__((noinline)) void make_widget(bool go, void **) {
B b;
if (go) new (b, make_widget_r) T;
}
void *run_repro_p;
extern "C" __attribute__((visibility("default"))) void run_repro(int
argc) try {
make_widget(argc, &run_repro_p);
}
catch (...) {
}
// driver.cpp
extern "C" void run_repro();
main() {
run_repro();
}