home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / g / bug / 2075 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.3 KB  |  62 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!ise.fhg.de!max
  3. From: max@ise.fhg.de (Max Kubierschky)
  4. Subject: (none)
  5. Message-ID: <9212221734.AA11009@server1.ise.fhg.de>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Tue, 22 Dec 1992 19:34:56 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 48
  12.  
  13. g++ produces incorrect code compiling:
  14. ------------------------ cut here -------------------------
  15. #include <iostream.h>
  16.  
  17. class A
  18. {
  19.   public:
  20.     A( int j ) { i=j; }
  21.     int i;
  22. };
  23.  
  24. class B
  25. {
  26.   public:
  27.     B() {}
  28.     B( const A& a, const A& ) { cout << a.i << endl; }
  29.     B operator+( const B& ) { return *this; }
  30. };
  31.  
  32. B b( B() + B(1,2) );
  33.  
  34. main() {}
  35. ------------------------ cut here -------------------------
  36. When I execute the produced program, I get: 
  37. 2
  38. Whereas my idea of correct code is something producing:
  39. 1
  40.  
  41. ###output from  `g++ -v t.C', with t.C being the listed program:
  42. Reading specs from /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/specs
  43. gcc version 2.2.2
  44.  /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dhp9000s200 -Dhp9000s300 -DPWB -Dhpux -Dunix -D__hp9000s300 -D__hp9000s200 -D__PWB -D__hpux -D__unix -D__hp9000s200__ -D__hp9000s300__ -D__PWB__ -D__hpux__ -D__unix__ -D__hp9000s300 -D__hp9000s200 -D__PWB -D__hpux -D__unix -D__hp9000s200 -D__hp9000s300 -D__PWB -D__hpux -D__unix -D__hp9000s300 -D__hp9000s200 -D__PWB -D__hpux -D__unix -D__HAVE_68881__ -Dmc68020 -D_HPUX_SOURCE -D__HPUX_ASM__ t.C /us
  45. r/tmp/cca10862.i
  46. GNU CPP version 2.2.2 (68k, SGS/hpux syntax)
  47.  /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/cc1plus /usr/tmp/cca10862.i -quiet -dumpbase t.cc -version -o /usr/tmp/cca10862.s
  48. GNU C++ version 2.2.2 (68k, SGS/hpux syntax) compiled by CC.
  49.  as -o t.o /usr/tmp/cca10862.s
  50.  /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/ld /lib/crt0.o -L /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2 -L /usr/local/gnu/lib t.o -lg++ /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/libgcc.a -lc /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/libgcc.a
  51.  
  52. ###output from `uname -a':
  53. HP-UX server1 B.08.00 B 9000/385 0800091148c7
  54.  
  55. ###output from `ll /usr/gnu/src/gcc-2.2.2/tm.h /usr/gnu/src/gcc-2.2.2/md':
  56. lrwxr-xr-x   1 gnu      other         16 Jul 21 11:07 /usr/gnu/src/gcc-2.2.2/md -> ./config/m68k.md
  57. lrwxr-xr-x   1 gnu      other         16 Jul 21 11:07 /usr/gnu/src/gcc-2.2.2/tm.h -> ./config/hp320.h
  58.  
  59. Max
  60.  
  61.  
  62.