Bug 20683 - wrong warning when using "-Woverloaded-virtual"
Summary: wrong warning when using "-Woverloaded-virtual"
Status: RESOLVED DUPLICATE of bug 20423
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-29 12:19 UTC by Oliver Stoeneberg
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
preprocessed source (148 bytes, application/octet-stream)
2005-03-29 12:19 UTC, Oliver Stoeneberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Stoeneberg 2005-03-29 12:19:06 UTC
The following code produces a wrong warning:

class A {
public:
	virtual ~A() {};
	virtual void Update( int ) {};
protected:
	virtual void Update( int, float ) {};
};

class B : public A {
public:	
	virtual void Update( int ) {};
};

6 C:\Dev-Cpp\Projects\test-stlport\main_7.cpp [Warning] 'virtual void
A::Update(int, float)' was hidden 
11 C:\Dev-Cpp\Projects\test-stlport\main_7.cpp [Warning]   by 'virtual void
B::Update(int)' 

I thought the warnign was only supposed to happen, if B has no virtual in front
of the function "Update", which is inherited from A.

I am using:

Using built-in specs.
Target: i686-pc-mingw32
Configured with: /datal/gcc/gcc/configure --prefix=/datal/gcc/build/wingcc
--build=i686-pc-linux-gnu --host=i686-pc-mingw32 --target=i686-pc-mingw32
--enable-languages=c,c++,java --with-gcc --with-gnu-as --with-gnu-ld
--enable-threads=win32 --disable-nls --disable-win32-registry --disable-shared
--disable-debug --without-newlib --enable-libgcj --disable-java-awt --without-x
--enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
--enable-hash-synchronization --enable-sjlj-exceptions --enable-libgcj-multifile
--enable-libgcj-mingw-osapi=ansi
Thread model: win32
gcc version 4.0.0 20050324 (prerelease)
Comment 1 Oliver Stoeneberg 2005-03-29 12:19:43 UTC
Created attachment 8487 [details]
preprocessed source
Comment 2 Andrew Pinski 2005-03-29 14:10:31 UTC
Actually the warning is correct.
This is a dup of bug 20423 which has not been closed yet because I did not want to close it yet and 
there could be a better warning message.

*** This bug has been marked as a duplicate of 20423 ***