This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/8045] Missing "unused variable" warning
- From: "gerald at pfeifer dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 May 2010 16:39:48 -0000
- Subject: [Bug c++/8045] Missing "unused variable" warning
- References: <bug-8045-3310@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from gerald at pfeifer dot com 2010-05-01 16:39 -------
(In reply to comment #0)
> Consider the following code snippet:
> bash-2.05$ cat foo.cc
> struct X { int y; };
>
> void foo() {
> X c;
> X tmp2;
> X d = tmp2;
> }
>
> Both c and d are unused. However, we only get an 'unused variable' warning from c.
A current (2010-04-26) snapshot of GCC 4.6 detects both cases:
y.c: In function 'foo':
y.c:5:5: warning: unused variable 'd' [-Wunused-variable]
y.c:3:5: warning: unused variable 'c' [-Wunused-variable]
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8045