🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1165

(none)

#1165
From: Max Kubierschky
Date: Tue, 22 Dec 1992 19:34
47 lines
2463 bytes
g++ produces incorrect code compiling:
------------------------ cut here -------------------------
#include <iostream.h>

class A
{
  public:
	A( int j ) { i=j; }
	int i;
};

class B
{
  public:
	B() {}
	B( const A& a, const A& ) { cout << a.i << endl; }
	B operator+( const B& ) { return *this; }
};

B b( B() + B(1,2) );

main() {}
------------------------ cut here -------------------------
When I execute the produced program, I get: 
2
Whereas my idea of correct code is something producing:
1

###output from  `g++ -v t.C', with t.C being the listed program:
Reading specs from /usr/local/gnu/lib/gcc-lib/m68k-hp-hpux/2.2.2/specs
gcc version 2.2.2
 /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
r/tmp/cca10862.i
GNU CPP version 2.2.2 (68k, SGS/hpux syntax)
 /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
GNU C++ version 2.2.2 (68k, SGS/hpux syntax) compiled by CC.
 as -o t.o /usr/tmp/cca10862.s
 /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

###output from `uname -a':
HP-UX server1 B.08.00 B 9000/385 0800091148c7

###output from `ll /usr/gnu/src/gcc-2.2.2/tm.h /usr/gnu/src/gcc-2.2.2/md':
lrwxr-xr-x   1 gnu      other         16 Jul 21 11:07 /usr/gnu/src/gcc-2.2.2/md -> ./config/m68k.md
lrwxr-xr-x   1 gnu      other         16 Jul 21 11:07 /usr/gnu/src/gcc-2.2.2/tm.h -> ./config/hp320.h

Max
Technical Details
Message-ID: <9212221734.AA11009@server1.ise.fhg.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ise.fhg.de!max

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ise.fhg.de!max
From: max@ise.fhg.de (Max Kubierschky)
Subject: (none)
Message-ID: <9212221734.AA11009@server1.ise.fhg.de>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 22 Dec 1992 19:34:56 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 48