[Bug c++/92831] CWG1299 extend_ref_init_temps_1 punts on COND_EXPRs

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Dec 6 20:17:00 GMT 2019


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Dec  6 20:16:27 2019
New Revision: 279064

URL: https://gcc.gnu.org/viewcvs?rev=279064&root=gcc&view=rev
Log:
        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.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/temp-extend2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/testsuite/ChangeLog


More information about the Gcc-bugs mailing list