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]

c++/2284: Spurious unused parameter warning



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


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