home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!agate!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!tully.cs.berkeley.edu!hilfingr
- From: hilfingr@tully.cs.berkeley.edu (Paul N. Hilfinger)
- Newsgroups: gnu.g++.bug
- Subject: Access control error?
- Date: 26 Jan 1993 21:50:31 -0500
- Organization: GNUs Not Usenet
- Lines: 46
- Sender: daemon@cis.ohio-state.edu
- Approved: bug-g++@prep.ai.mit.edu
- Distribution: gnu
- Message-ID: <9301260847.AA04974@tully.CS.Berkeley.EDU.iliad>
-
- The following program compiles without error under gcc-2.3.3. It
- should instead give an error message, since f is not accessible
- through D. Substituting the commented-out declaration of x causes gcc
- to correctly identify an error. For some reason, the extra level of
- derivation makes a difference.
-
- P. Hilfinger
-
- Session:
-
- % gcc-2.3.3 -v -Wall -o misc misc.C
- Reading specs from /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
- gcc version 2.3.3
- /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -Wall misc.C /usr/tmp/cca04944.i
- GNU CPP version 2.3.3 (sparc)
- /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca04944.i -quiet -dumpbase misc.cc -Wall -version -o /usr/tmp/cca04944.s
- GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
- as -o /usr/tmp/cca049441.o /usr/tmp/cca04944.s
- /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/ld -e start -dc -dp -o misc /lib/crt0.o -L/usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3 -L/usr/sww/lib /usr/tmp/cca049441.o -lgcc -lc -lgcc
- %
-
- Source:
-
- ------------------------------cut here----------------------------------------
- class A {
- public:
- virtual void f() {}
- };
-
- class C: public A {
- private:
- void f() { }
- };
-
- class D : public C {
- };
-
- int main()
- {
- D* x = new D;
- // C* x = new C;
-
- x -> f();
- return 0;
- }
-
-