This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7780: -Woverloaded-virtual generating false-positives
- From: linux_dr at yahoo dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 30 Aug 2002 18:30:09 -0000
- Subject: c++/7780: -Woverloaded-virtual generating false-positives
- Reply-to: linux_dr at yahoo dot com
>Number: 7780
>Category: c++
>Synopsis: -Woverloaded-virtual generating false-positives
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Aug 30 11:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Loren Osborn <linux_dr@yahoo.com>
>Release: gcc 3.2
>Organization:
>Environment:
Linux Mandrake 8.1
>Description:
-Woverloaded-virtual reports that a member function "was hidden by" another member function any time a derived class implements a virtual function that is overloaded.
>From gcc man page:
-Woverloaded-virtual
(C++ only.) In a derived class, the
definitions of virtual functions must
match the type signature of a virtual
function declared in the base class. Use
this option to request warnings when
a derived class declares a function that
may be an erroneous attempt to define a
virtual function: that is, warn when a
function with the same name as a
virtual function in the base class, but
with a type signa ture that doesn't match
any virtual functions from the base class.
According to my interpertation of this it should only report overloading a member function where the base class does not declare the same member function with the same arguments.
See attached minimal test case.
>How-To-Repeat:
/usr/local/bin/g++ -Woverloaded-virtual -c -o /dev/null gcc-hiding-detection-bug.cpp
>Fix:
to detect these occurances as different situations
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gcc-hiding-detection-bug.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gcc-hiding-detection-bug.cpp"
LyogI2RlZmluZSBDQVVTRV9BTl9FUlJPUiAqLwpjbGFzcyBBCnsKCXB1YmxpYzoKCQl2aXJ0dWFs
IGludCBUaGlzRnVuY3Rpb25TaG91bGRDYXVzZUFIaWRpbmdXYXJuaW5nKGZsb2F0KTsKCQl2aXJ0
dWFsIGludCBUaGlzRnVuY3Rpb25TaG91bGRDYXVzZUFIaWRpbmdXYXJuaW5nKGNoYXIqKTsKCQl2
aXJ0dWFsIGludCBUaGlzRnVuY3Rpb25TaG91bGROb3RDYXVzZUFIaWRpbmdXYXJuaW5nKGNoYXIq
KTsKCQl2aXJ0dWFsIGludCBUaGlzRnVuY3Rpb25TaG91bGROb3RDYXVzZUFIaWRpbmdXYXJuaW5n
KGNoYXIqLGludCk7CiNpZmRlZiBDQVVTRV9BTl9FUlJPUgoJCXZpcnR1YWwgaW50IFRoaXNGdW5j
dGlvblNob3VsZENhdXNlQUVycm9yKGNoYXIqKTsKI2VuZGlmIC8vIENBVVNFX0FOX0VSUk9SCn07
CgpjbGFzcyBCIDogcHVibGljIEEKewoJcHVibGljOgoJCXZpcnR1YWwgaW50IFRoaXNGdW5jdGlv
blNob3VsZENhdXNlQUhpZGluZ1dhcm5pbmcoaW50KTsKCQl2aXJ0dWFsIGludCBUaGlzRnVuY3Rp
b25TaG91bGROb3RDYXVzZUFIaWRpbmdXYXJuaW5nKGNoYXIqLGludCk7CiNpZmRlZiBDQVVTRV9B
Tl9FUlJPUgoJCXZpcnR1YWwgY2hhciogVGhpc0Z1bmN0aW9uU2hvdWxkQ2F1c2VBRXJyb3IoY2hh
ciopOwojZW5kaWYgLy8gQ0FVU0VfQU5fRVJST1IKfTsKCmludCBtYWluKCkKewoJcmV0dXJuIDA7
Cn0K