🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

(none)

#1023
From: Werner Benger
Date: Mon, 05 Oct 1992 22:05
39 lines
1654 bytes
 Dear Debuggers of the GNU C++ Compiler,

 There seems to be another bug in the GNU C++ 2.2.2 Compiler:
 If a constant reference is created, the value of the original variable
 is copied once to a different place where the reference points to.
 Therefore the reference value is not affected when the variable is changed.
 In the following example the output should be: 
	   19 5 7 11        instead of       19 19 19 19
 The same error occurs when "int" is changed to "double".
 While debugging, I detected also an mistake ( is it a mistake ?)
 in <iostream.h> :
            ostream&operator<<(ostream&,void*) 
  should be changed into
            ostream&operator<<(ostream&,const void*) 
  since the content of a pointer been printed out is not changed 
  ( at least it should not ).  With the current version a warning message
  is produced when compiling the program below.

 Good luck for killing these bugs,

 			Werner (werner@ast1.uibk.ac.at)



#include <iostream.h>

int x=19;

main()
{
const int&y=x;

	cout << y << " ";
	x=5;	cout << y << " ";
	x=7;	cout << y << " ";
	x=11;	cout << y << " ";
	cout << &x << "   " << &y << '\n';
	return 0;
}
Technical Details
Message-ID: <9210052005.AA08803@ast1.uibk.ac.at>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!ast1.uibk.ac.at!werner

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!ast1.uibk.ac.at!werner
From: werner@ast1.uibk.ac.at (  Werner Benger     )
Subject: (none)
Message-ID: <9210052005.AA08803@ast1.uibk.ac.at>
Sender: gnulists@ai.mit.edu
Organization: Gnus Not Usenet
Distribution: gnu
Date: Mon, 5 Oct 1992 22:05:34 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 45