This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/2284: Spurious unused parameter warning
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/2284: Spurious unused parameter warning
- From: snyder at fnal dot gov
- Date: Tue, 13 Mar 2001 21:53:36 -0600
- Reply-To: snyder at fnal dot gov
>Number: 2284
>Category: c++
>Synopsis: Spurious unused parameter warning
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 13 20:06:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: scott snyder
>Release: 3.0 20010312 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 2000 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long
>Description:
If the example below is compiled with `-W -Wall', g++ warns about
an unused parameter in the constructor,
even though the parameter is not named in the constructor definition.
I also note that the warning goes away if i change the function from
a constructor to an ordinary member function.
>How-To-Repeat:
---------------------------------------------------
struct Foo
{
Foo (int flg);
};
Foo::Foo (int) {}
---------------------------------------------------
$ ./cc1plus -W -Wall -quiet x.cc
x.cc: In method `Foo::Foo(int)':
x.cc:3: warning: unused parameter `int flg'
x.cc: In method `Foo::Foo(int)':
x.cc:3: warning: unused parameter `int flg'
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: