This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PR 54197: lifetime of reference not properly extended


This patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54197.

Certain constructs (see bug for examples) cause C++ references to be
initialized with COMPOUND_EXPR's.  The old logic was ignoring these,
causing those temporaries to be prematurely destroyed.

Tested on trunk via full x86_64 bootstrap and testsuite.

Okay for trunk and backport to gcc-4_7-branch?

Ollie


2012-08-13  Ollie Wild  <aaw@google.com>

        PR c++/54197
        * gcc/cp/call.c (extend_ref_init_temps_1): Handle COMPOUND_EXPR trees.
        * gcc/testsuite/g++.dg/init/lifetime3.C: New test.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]