This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61465] New: Bogus parameter set but not used warning in constructor initialization list
- From: "fanael4 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Jun 2014 18:16:14 +0000
- Subject: [Bug c++/61465] New: Bogus parameter set but not used warning in constructor initialization list
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61465
Bug ID: 61465
Summary: Bogus parameter set but not used warning in
constructor initialization list
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fanael4 at gmail dot com
When compiling the following code with C++11 and -Wunused-but-set-parameter on
struct Foo {
Foo(void* x) : y{static_cast<char*>(x)} {}
char* y;
};
GCC (tested on 4.7.0 and 4.9.1) incorrectly complains:
x.cpp:2:13: warning: parameter 'x' set but not used
[-Wunused-but-set-parameter]
Which is clear nonsense, as the parameter is used. If the initialization list
is changed to use parentheses, or the static_cast is removed and y's type is
changed, the warning goes away.