c++/1901: class method, when overloaded, hides methods with the same name

vladimir.kondratiev@intel.com vladimir.kondratiev@intel.com
Wed Feb 7 07:16:00 GMT 2001


>Number:         1901
>Category:       c++
>Synopsis:       class method, when overloaded, hides methods with the same name
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 07 07:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Vladimir Kondratiev
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
Linux/Intel RedHat 7.0; glibc 2.2, gcc was compiled with patch from gcc home page; no flags to 'configure'
>Description:
Assume there are class A and class B : public A;
in class A there are several methods with the same name but different parameters. Class B overloads one of the methods mentioned above.

Now, when one calls for object of class B method inherited from class A, error message is generated.
Since there is no preprocessor code and .ii file is identical to the .cpp one, I attached .cpp only
Compiler output:
[vkondra-l@vkondra-mobl gcc-bug]$ gcc -c test.cpp
test.cpp: In function `int main(int, char **)':
test.cpp:14: no matching function for call to `B::f (int, int)'
test.cpp:9: candidates are: void B::f(int)

>How-To-Repeat:
gcc -c test.cpp
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/cpp; name="test.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test.cpp"

Y2xhc3MgQSB7CnB1YmxpYzoKICB2b2lkIGYoaW50KSB7fQogIHZvaWQgZihpbnQsaW50KSB7fQp9
OwoKY2xhc3MgQiA6IHB1YmxpYyBBIHsKcHVibGljOgogIHZvaWQgZihpbnQpIHt9Cn07CgppbnQg
bWFpbihpbnQsIGNoYXIqW10pIHsKICBCIGI7CiAgYi5mKDAsMCk7Cn0K


More information about the Gcc-bugs mailing list