This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

gcc 3.0.4 rejects this code, but 2.95.2 compiled it.


The following code compiled fine under 2.95.2 but not 3.0.4
(except for possible typos in entering this email.  I'm doing a
manual "cut and paste" between to disconnected computers
by reading from one screen and typing on the other :-)

class A {
    // yadda, yadda, yadda...
    private:
         class B {
            int whatever;
            };
    };

class C {
    // whatever...
    friend class A::B;
    };

Gives the compiler error

    test.cc:8: `class A:B' is private
    test.cc:16: within this context

The "this context" is the friend decl.  Since I'm specifying that I want to
allow A::B to have access to C, the fact that A::B is private should be
irrelevant.  Obviously this is a simplified example.  In the real code, A::B
actually has methods that attempt to muck with private members of C.

It appears that there is a logged error for something like this (5551), but
no action has been taken.


 -- Dave Williss
------
Meddle not in the affairs of dragons,
   for you are crunchy and taste good with catsup


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