]> git.ipfire.org Git - thirdparty/gcc.git/commit
PR c++/29028 - Missed unused warning on using declaration
authorDodji Seketeli <dodji@redhat.com>
Fri, 28 Sep 2012 12:51:30 +0000 (12:51 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Fri, 28 Sep 2012 12:51:30 +0000 (14:51 +0200)
commit3b4441db79de403b90038af98f8641c19ff0953b
tree62e97833b7985d32ad245d045f3f22483e828606
parent2be9064dedcf93581e0596151454573d8c37f8be
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.

From-SVN: r191829
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/Wunused-var-18.C [new file with mode: 0644]