This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38958] 'unused variable' warning emitted when extending the lifetime of a returned RAII type by holding a reference to const despite delayed destructor side-effects. [dtor]
- From: "jason at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 07 Jan 2015 15:18:37 +0000
- Subject: [Bug c++/38958] 'unused variable' warning emitted when extending the lifetime of a returned RAII type by holding a reference to const despite delayed destructor side-effects. [dtor]
- Auto-submitted: auto-generated
- References: <bug-38958-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38958
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Wed Jan 7 15:18:05 2015
New Revision: 219306
URL: https://gcc.gnu.org/viewcvs?rev=219306&root=gcc&view=rev
Log:
PR c++/63657
PR c++/38958
* call.c (set_up_extended_ref_temp): Set TREE_USED on the reference
if the temporary has a non-trivial destructor.
* decl.c (poplevel): Don't look through references.
Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/warn/Wunused-var-22.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/call.c
branches/gcc-4_9-branch/gcc/cp/decl.c