[Bug c++/94041] [10 Regression] temporary object destructor called before the end of the full-expression since r10-5577

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Mar 10 19:49:19 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94041

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
This turned out to be a long-standing bug with split_nonconstant_init (since
4.7, apparently): initializion of individual elements of an aggregate are not a
full-expressions, but split_nonconstant_init was making full-expressions out of
them.  My fix for PR66139 extended the use of split_nonconstant_init, and thus
the bug, to aggregate initialization of temporaries within an expression, in
which context the bug is more noticeable.

This is a tricky one, getting back into the issues with cleanups not nesting
properly that wrap_temporary_cleanups handles some of, but not this example.


More information about the Gcc-bugs mailing list