This is the mail archive of the gcc-prs@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]

c++/8045: Missing "unused variable" warning


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


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