Topic: [Q]: typedef inside class body name hiding...


Author: sergey@cis.ohio-state.edu (Sergey Zhupanov)
Date: 1995/04/06
Raw View
Folks, I am using Borland 4.02 on PC and GNU on HP UNIX and
they produce radically different behavior in the following
situation, and I am unclear which one is right (I could not
find explicit answer in the ARM):

class A {
...
public:
    static void boo(); // Some publicly accessible static operation
...
};

class B {
...
public:
    static void boo(); // operation with same name/interface as A::boo()
...
};

class C {
...
public:
   C ();
...
private:
   typedef B A;
...
};

C::C () { A::boo(); } // C's constructor intended to call C::A::boo()
                      // which is the same as ::B::boo()

Now, Borland calls ::A::boo() which I think is a bug (is it?)
while GNU calls what I want -- ::B::boo(), so who is right ?

This example is synthesized to demonstrate the bug -- the actual situation
is considerably more complex (all classes are templates, and inheritance is
involved, but the same "bug?" occurs on Borland even in the simple example.

I would really appreciate it if you could CC a recponce to the email
address below -- I do not follow the newsgroup very regularly.

Thanks very much,
  sergey

EMAIL: sergey@cis.ohio-state.edu