https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125771
--- Comment #2 from Wang Jinghao <zheng.xianyuwang at gmail dot com> ---
split_nonconstant_init_1() recursively generates cleanup actions, while the
outermost split_nonconstant_init() appends statements that disable those
cleanups. The generated sequence is roughly as follows:
construct a.b.c
register cleanup for a.b.c
[construct a.b]
register cleanup for a.b
throw
disable cleanup for a.b
disable cleanup for a.b.c
Therefore, on the exception path, execution never reaches the statements that
disable the cleanups. As a result, B::~B() and C::~C() are invoked in sequence,
causing the object to be destroyed twice.