This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PR 54197: lifetime of reference not properly extended
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ollie Wild <aaw at google dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>, Paul Pluzhnikov <ppluzhnikov at google dot com>
- Date: Mon, 13 Aug 2012 22:50:56 +0200
- Subject: Re: C++ PR 54197: lifetime of reference not properly extended
- References: <CAFOgFcRdX=8p2ctHZmAP=r6qZMWq4j1egtuFesawhOzbLPzU3Q@mail.gmail.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Aug 13, 2012 at 03:47:43PM -0500, Ollie Wild wrote:
> diff --git a/gcc/cp/call.c b/gcc/cp/call.c
> index 5345f2b..b2fac16 100644
> --- a/gcc/cp/call.c
> +++ b/gcc/cp/call.c
> @@ -8924,6 +8924,12 @@ extend_ref_init_temps_1 (tree decl, tree init, VEC(tree,gc) **cleanups)
> tree sub = init;
> tree *p;
> STRIP_NOPS (sub);
> + if (TREE_CODE (sub) == COMPOUND_EXPR)
> + {
> + TREE_OPERAND(sub, 1) = extend_ref_init_temps_1 (
> + decl, TREE_OPERAND(sub, 1), cleanups);
> + return init;
> + }
The formatting doesn't match GCC coding conventions in several ways.
You don't have spaces before (, and ( shouldn't be at the end of line if
possible.
TREE_OPERAND (sub, 1)
= extend_ref_init_temps_1 (decl, TREE_OPERAND (sub, 1), cleanups);
is what should be used instead.
Jakub