home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / g / bug / 2341 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.9 KB  |  59 lines

  1. 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
  2. From: hilfingr@tully.cs.berkeley.edu (Paul N. Hilfinger)
  3. Newsgroups: gnu.g++.bug
  4. Subject: Access control error?
  5. Date: 26 Jan 1993 21:50:31 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 46
  8. Sender: daemon@cis.ohio-state.edu
  9. Approved: bug-g++@prep.ai.mit.edu
  10. Distribution: gnu
  11. Message-ID: <9301260847.AA04974@tully.CS.Berkeley.EDU.iliad>
  12.  
  13. The following program compiles without error under gcc-2.3.3.  It
  14. should instead give an error message, since f is not accessible
  15. through D.  Substituting the commented-out declaration of x causes gcc
  16. to correctly identify an error.  For some reason, the extra level of
  17. derivation makes a difference.
  18.  
  19. P. Hilfinger
  20.  
  21. Session:
  22.  
  23. % gcc-2.3.3 -v -Wall -o misc misc.C
  24. Reading specs from /usr/sww/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
  25. gcc version 2.3.3
  26.  /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
  27. GNU CPP version 2.3.3 (sparc)
  28.  /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
  29. GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
  30.  as -o /usr/tmp/cca049441.o /usr/tmp/cca04944.s
  31.  /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
  32.  
  33. Source: 
  34.  
  35. ------------------------------cut here----------------------------------------
  36. class A {
  37. public:
  38.     virtual void f() {}
  39. };
  40.  
  41. class C: public A {
  42. private:
  43.     void f() {  }
  44. };
  45.  
  46. class D : public C {
  47. };
  48.  
  49. int main()
  50. {
  51.     D* x = new D;
  52. //  C* x = new C;
  53.  
  54.     x -> f();
  55.     return 0;
  56. }
  57.  
  58.