[Bug c++/29028] No warning about unused names introduced with using declarations
dodji at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 28 12:52:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29028
--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> 2012-09-28 12:51:42 UTC ---
Author: dodji
Date: Fri Sep 28 12:51:30 2012
New Revision: 191829
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191829
Log:
PR c++/29028 - Missed unused warning on using declaration
In the example of the patch, g++ fails to warn that the variable N::i
(introduced via a using declaration) is unused.
This is because as we want to emit the warning in poplevel, when we
walk the local bindings returned by getdecls, we forget that a
VAR_DECL introduced by a using declaration is represented by a
TREE_LIST which TREE_VALUE is the VAR_DECL, and we wrongly look for a
bare VAR_DECL.
Fixed thus and tested on x86_64-unknown-linux-gnu against trunk.
gcc/cp/
* decl.c (poplevel<warn_unused*>): Do not forget that some local
bindings are represented by a TREE_LIST.
gcc/testsuite/
* g++.dg/warn/Wunused-var-18.C: New test.
Added:
trunk/gcc/testsuite/g++.dg/warn/Wunused-var-18.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/decl.c
trunk/gcc/testsuite/ChangeLog
More information about the Gcc-bugs
mailing list