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

Re: Visibility problems in gcc 2.95.2


Hello, I am Cassius Vinicius. I would like to contribute to this mailing
list.
I apologize for my poor English.

using the standard ISO/IEC C++:
class B
{
  public:
    int f(int);
};

class D: public B
{
  public:
    using B::f;
    int f(char*);
};

int main()
{
  D obj;

  obj.f(123);
  obj.f("Hello.");

  return 0;
}

It should work, but the gcc (2.95.2) doesn't recognize 'using' declaration.

----- Original Message -----
From: "brent verner" <brent@rcfile.org>
To: "Denis Perchine" <dyp@perchine.com>
Cc: "Artem Khodush" <artem@duma.gov.ru>; <gcc@gcc.gnu.org>
Sent: Monday, October 09, 2000 5:43 AM
Subject: Re: Visibility problems in gcc 2.95.2


> On 09 Oct 2000 at 14:55 (+0700), Denis Perchine wrote:
> | On  9 ïËÔÑÂÒØ 2000 14:54, Artem Khodush wrote:
> | >
> | > This is not a bug.
> | > It may seem wrong to you, but that's how c++ works.
> | > The declaration of rread in class B hides one in class A.
> |
> | Could you please give me reference to a standard, if it is not so hard
for
> | you. I'm just wondering why it is the case. Methods have different
> | signatures...
>
> I initially started an email supporting your bug report, but my search
> thru the standard found this:
>
> 13.2 Declaration matching                   [over.dcl]
>
>   [Example:
>
>     class B {
>     public:
>           int f(int);
>     };
>
>     class D : public B {
>     public:
>           int f(char*);
>     };
>     file://Here D::f(char*) hides B::f(int) rather than overloading it.
>     void h(D* pd)
>     {
>           pd->f(1); // error:
>                     // D::f(char*) hides B::f(int)
>           pd->B::f(1);  // OK
>           pd->f("Ben"); // OK, calls D::f
>     }
>
>   -end example]
>
>
> It does _seem_ overloading resolution could (should?) be used to access
> the hidden function, but I guess the language designers know better
> than me.
>
> hth.
>   brent
>
> --
> All opinions expressed are My own, unless otherwise attributed. In
> presenting facts, I expressly reserve the right to be Wrong. Portions
> of this message authored by Me are subject to the Free Thought License.
>


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