This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/8045] Missing "unused variable" warning



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]