[Bug c++/16029] New: incorrect "unused variable" message from -Wall

tromey at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 16 23:23:00 GMT 2004


Try this simple invalid program:

int main ()
{
  return whatever ();
}

I compile it with -Wall:

fleche. g++ -Wall -c main.cc
main.cc: In function `int main()':
main.cc:3: error: `whatever' was not declared in this scope
main.cc:3: warning: unused variable 'whatever'

The "unused variable" warning is odd, I think it should not
be emitted.


I'm using a recent cvs trunk:

Reading specs from
/home/tromey/gnu/Trunk/install/lib/gcc/i686-pc-linux-gnu/3.5.0/specs
Configured with: ../gcc/configure --prefix=/home/tromey/gnu/Trunk/install
--enable-languages=c++,java --enable-threads=posix --enable-checking=tree
--enable-java-awt=gtk,xlib --disable-static
Thread model: posix
gcc version 3.5.0 20040616 (experimental)

-- 
           Summary: incorrect "unused variable" message from -Wall
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tromey at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16029



More information about the Gcc-bugs mailing list