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

Re: Warning about uninitialized members in initializer list


Hi Mike.

Try
g++ -Wall -Wextra testtest.cpp
testtest.cpp:9: warning: unused parameter '_i'
testtest.cpp:9: warning: unused parameter '_i'

With line 9 the constructor of B.
Both gcc3.4.4 and gcc4.0.1.

However, I thought there would be a warning with
g++ -O3 -Wuninitialized -Winit-self testtest.cpp

Can anybody explain?

Thanks
-- Peter



On Tuesday 09 August 2005 19:29, Mike Rolish wrote:
> class A {
> public:
> ? ? int i;
> ? ? A(int _i) : i(_i) {}
> };
>
> class B : public A {
> public:
> ? ? B(int _i) : A(i) {} // bug, should be A(_i) or shadowing B(int i)
> };


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