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]

using-declaration and access control


egcs doesn't accept this code from Stroustrup3, Section 15.3.2.2.

egcs correctly finds the error on LINE 12, but the error message points
to
LINE 3 as the source of the problem.  This could be confusing for large
files.

Also, egcs incorrectly diagnoses LINE 13 as an error.

------

class B {
private:
    int a;      // LINE 3
protected:
    int b;      // LINE 5
public:
    int c;
};

class D : public B {
public:
    using B::a;  // error: B::a is private                      LINE 12
    using B::b;  // make B::b publically available through D    LINE 13
};

------

$ g++ -v
Reading specs from
/mnt/space/egcs-980205/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.9
1.07/specs
gcc version egcs-2.91.07 980205 (gcc-2.8.0 release)

$ g++ -c UsingTest.cc
UsingTest.cc:3: cannot make private `B::a' non-private
UsingTest.cc:5: cannot make protected `B::b' non-protected

---
Dallas Morlock
dallas@daktel.com


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