PR c++/92831 - CWG 1299, not extending temporary lifetime for ?:
authorJakub Jelinek <jakub@redhat.com>
Fri, 6 Dec 2019 20:16:27 +0000 (21:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 6 Dec 2019 20:16:27 +0000 (21:16 +0100)
commit2ee63d048eaee3c830c944970b1ad950bffc75b4
tree9b852594e7de1b641f92cda0e5cbecd9eea84934
parenteff6af8e0e9d750e13bedbe40ba70c395ba6234c
PR c++/92831 - CWG 1299, not extending temporary lifetime for ?:

* cp-tree.h (extend_ref_init_temps): Add a new argument with NULL
default arg.
* call.c (set_up_extended_ref_temp): Add COND_GUARD argument, pass it
down to extend_ref_init_temps.  Before pushing cleanup, if COND_GUARD
is non-NULL, create a bool temporary if needed, initialize to false
and guard the cleanup with the temporary being true.
(extend_ref_init_temps_1): Add COND_GUARD argument, pass it down
to recursive calls and set_up_extended_ref_temp.  Handle COND_EXPR.
(extend_ref_init_temps): Add COND_GUARD argument, pass it down to
recursive calls and to extend_ref_init_temps_1.

* g++.dg/cpp0x/temp-extend2.C: New test.

From-SVN: r279064
gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/temp-extend2.C [new file with mode: 0644]