Topic: Qualified name lookup


Author: Mando Gali <mando@uni-paderborn.de>
Date: 1999/06/30
Raw View
Hi!

I would like to know your opinions about the following case of
qualified name lookup. Let consider the example listed below.
I looked in the standard specification but I am not sure of what
is the right way a compiler has to proceed.


Let us consider the qualified identifier N::A::B in the member function
h.
Which B is meant according to the standard C++ in the function h with
 N::A::B  b;
is it ::N::A::B or ::C::N::A::B ?

The name lookup is in two steps: first name lookup for the nested name
specifier N::A
of the qualified identifier N::A::B and then unqualified name lookup of
B in the scope N::A.
The question is now how to proceed for the first step.
Thanks for any hint.

Mando Gali

class C{

 public :
  class N{

   public :
    class A {

     public:
      class B {
       public: void f(){ cout<<"::C::N::A::B::f()"<<endl; }
      };
    };
  };

};


class N{

 public:
  class A : public C{

   public:
    class B {
     public :
      void f(){ cout<<"::N::A::B::f()"<<endl; }
    };

    void h(){
     N::A::B  b;
     b.f();
    }

 };


};


======================================= MODERATOR'S COMMENT:

Bitte F'up2 setzen!

[dcliso-c++ FAQ    : http://www.logictools.de/cpp/dclcppfaq.html]
[Moderation Policy : http://www.logictools.de/cpp/modpolicy.html]
[Moderation        : dclisocpp-mod@bud.prima.de                 ]