From -6215388268347889946
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,30fbaa4c35736b35
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1992-06-03 20:46:00 PST
Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!att!allegra!alice!bs
From: bs@alice.att.com (Bjarne Stroustrup)
Newsgroups: comp.std.c++
Subject: Re: Access control
Message-ID: <22953@alice.att.com>
Date: 4 Jun 92 01:39:12 GMT
Article-I.D.: alice.22953
References: <Bp9xtF.Duv@math.waterloo.edu>
Organization: AT&T Bell Laboratories, Murray Hill NJ
Lines: 28



gjditchf@plg.waterloo.edu (Glen Ditchfield @ University of Waterloo) writes

 > This code is based on an example in the Annotated Reference Manual, page 240.

class X {
  private:
    enum E1 {a1, b1};
  public:
    enum E2 {a2, b2};
    };

void h(X* p) {
    X::E2 e2;
    int x2 = X::a2;

    X::E1 e1;			// Should be an error?
    int x1 = X::a1;
    }

 > The ARM says that the declaration of e1 is illegal, because E1 is private.
 > However, AT&T C++ 2.1.0, AT&T C++ 3.0.1, and g++ 2.1 all say that the
 > declaration is just fine.  (The compilers and the ARM agree that the use of
 > X::a1 on the next line is illegal.)
 >    Are the compilers wrong?  Is this part of the ARM obsolete?

The compilers are wrong. They haven't yet caught up to the ARM in this matter.


