Topic: Scope of fwd declaratoins of nested classes


Author: gnb@bby.com.au (Gregory Bond)
Date: 1995/12/14
Raw View
Try this for a corner case:

class A {
  public:
 class B;
  private:
 class B {
   public:
  int b;
 };
};

// Is A::B visible here? Or is the above declaration ill-formed?
// I.e. is the scope of A::B established when it is declared or when
// it is defined? or should the two scopes be the same?
// FWIW, g++ 2.7.1 thinks this is well-formed and A::B is visible.

--
Gregory Bond <gnb@bby.com.au> Burdett Buckeridge & Young Ltd Melbourne Australia
``Efforts to maintain the "purity" of a language only succeed in establishing an
  elite class of people who know the shibboleths.  Ordinary folks know better,
  even if they don't know what "shibboleth" means.'' - Larry Wall

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]