This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/8045: Missing "unused variable" warning
- From: austern at apple dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 25 Sep 2002 20:31:57 -0000
- Subject: c++/8045: Missing "unused variable" warning
- Reply-to: austern at apple dot com
>Number: 8045
>Category: c++
>Synopsis: Missing "unused variable" warning
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 25 13:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: austern@apple.com
>Release: 3.1, 3.1, cvs TOT
>Organization:
>Environment:
Linux
>Description:
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.
>How-To-Repeat:
bash-2.05$ ~/root/bin/g++ -c -Wunused foo.cc
foo.cc: In function `void foo()':
foo.cc:4: warning: unused variable `X c'
bash-2.05$
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: