https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119383
Kacper Słomiński <kacper.slominski72 at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kacper.slominski72 at gmail dot co | |m --- Comment #6 from Kacper Słomiński <kacper.slominski72 at gmail dot com> --- I have reduced one of the failing test cases from the boost test suite to the following code: struct base { virtual base *clone() const = 0; ~base() { } }; struct impl : virtual base { base *clone() const { return new impl; } }; const base *make_a_clone() { const base &base = impl{}; return base.clone(); } int main() { make_a_clone(); } Compiled with `-O0 -Wall -Wextra -Wpedantic -g` with no warnings. Comparing the disassembly of the binary produced by GCC 14 and 15, it seems the lifetime of the temporary `impl` object is not correctly extended to the lifetime of the reference, and it gets immediately deconstructed after being constructed.