This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Warning about uninitialized members in initializer list
- From: Peter Doerfler <doerfler at techinfo dot rwth-aachen dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 10 Aug 2005 11:18:39 +0200
- Subject: Re: Warning about uninitialized members in initializer list
- References: <Pine.GSO.4.58L.0508091312460.26020@multics.mit.edu>
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)
> };