PR c++/92871 - bad code with xvalue and GNU ?: extension.
authorJason Merrill <jason@redhat.com>
Wed, 15 Jan 2020 14:31:11 +0000 (09:31 -0500)
committerJason Merrill <jason@redhat.com>
Wed, 15 Jan 2020 20:02:28 +0000 (15:02 -0500)
commit7192b1ec12484f5ca8b20930d8dc4d28ab4a533a
tree5e48e9dc719ed39cfc30318de6ce5c84ecb9e716
parentbc071d3a951a98284a3f46043afd44c03c123376
PR c++/92871 - bad code with xvalue and GNU ?: extension.

I steered Jakub wrong on the desired behavior for temp-extend1.C in the
context of bug 92831; it doesn't make sense to try to extend the lifetime of
a temporary that we've already materialized to evaluate the test.  So this
patch munges the stabilized expression so that it won't be subject to
lifetime extension.

* call.c (prevent_lifetime_extension): New.
(build_conditional_expr_1): Use it.
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/ext/temp-extend1.C